Package io.vertx.httpproxy

## Interface ProxyRequest

-     public interface ProxyRequest

  Handles the interoperability of the request between the user agent and the origin.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `absoluteURI()` |
    `HostAndPort` | `getAuthority()` |
    `Body` | `getBody()` |
    `HttpMethod` | `getMethod()` |
    `String` | `getURI()` |
    `MultiMap` | `headers()` |
    `HttpServerRequest` | `proxiedRequest()` |
    `default Future<Void>` | `proxy​(HttpClientRequest request)` | Proxy this request to the origin server using the specified `request` and then send the proxy response.
    `ProxyRequest` | `putHeader​(CharSequence name, CharSequence value)` | Put an HTTP header
    `ProxyRequest` | `release()` | Release the proxy request and its associated resources
    `ProxyResponse` | `response()` | Create and return the proxy response.
    `static ProxyRequest` | `reverseProxy​(HttpServerRequest proxiedRequest)` | Create a new `ProxyRequest` instance, the proxied request will be paused.
    `Future<ProxyResponse>` | `send​(HttpClientRequest request)` | Send this request to the origin server using the specified `request`.
    `ProxyRequest` | `setAuthority​(HostAndPort authority)` | Set the request authority for HTTP/1 the Host header for HTTP/2 the :authority pseudo header The value must follow the <host>:<port> syntax.
    `ProxyRequest` | `setBody​(Body body)` | Set the request body to be sent to the origin server.
    `ProxyRequest` | `setMethod​(HttpMethod method)` | Set the HTTP method to be sent to the origin server.
    `ProxyRequest` | `setURI​(String uri)` | Set the request URI to be sent to the origin server.
    `HttpVersion` | `version()` |

- - ### Method Detail

    - #### reverseProxy

          static ProxyRequest reverseProxy​(HttpServerRequest proxiedRequest)

      Create a new `ProxyRequest` instance, the proxied request will be paused.
      Parameters:
        `proxiedRequest` - the `HttpServerRequest` that is proxied
      Returns:
        a reference to this, so the API can be used fluently

    - #### version

          HttpVersion version()

      Returns:
        the HTTP version of the proxied request

    - #### absoluteURI

          String absoluteURI()

      Returns:
        the absolute URI of the proxied request

    - #### getMethod

          HttpMethod getMethod()

      Returns:
        the HTTP method to be sent to the origin server.

    - #### setMethod

          ProxyRequest setMethod​(HttpMethod method)

      Set the HTTP method to be sent to the origin server.

      The initial HTTP method value is the proxied request HTTP method.

      Parameters:
        `method` - the new HTTP method
      Returns:
        a reference to this, so the API can be used fluently

    - #### getURI

          String getURI()

      Returns:
        the request URI to be sent to the origin server.

    - #### setURI

          ProxyRequest setURI​(String uri)

      Set the request URI to be sent to the origin server.

      The initial request URI value is the proxied request URI.

      Parameters:
        `uri` - the new URI
      Returns:
        a reference to this, so the API can be used fluently

    - #### getBody

          Body getBody()

      Returns:
        the request body to be sent to the origin server.

    - #### setBody

          ProxyRequest setBody​(Body body)

      Set the request body to be sent to the origin server.

      The initial request body value is the proxied request body.

      Parameters:
        `body` - the new body
      Returns:
        a reference to this, so the API can be used fluently

    - #### setAuthority

          ProxyRequest setAuthority​(HostAndPort authority)

      Set the request authority
      - for HTTP/1 the Host header
      - for HTTP/2 the :authority pseudo header
      The value must follow the <host>:<port> syntax.
      Parameters:
        `authority` - the authority
      Returns:
        a reference to this, so the API can be used fluently

    - #### getAuthority

          HostAndPort getAuthority()

      Returns:
        the request authority, for HTTP2 the :authority pseudo header otherwise the Host header

    - #### headers

          MultiMap headers()

      Returns:
        the headers that will be sent to the origin server, the returned headers can be modified. The headers map is populated with the proxied request headers

    - #### putHeader

          ProxyRequest putHeader​(CharSequence name,
                                 CharSequence value)

      Put an HTTP header
      Parameters:
        `name` - The header name
        `value` - The header value
      Returns:
        a reference to this, so the API can be used fluently

    - #### proxy

          default Future<Void> proxy​(HttpClientRequest request)

      Proxy this request to the origin server using the specified `request` and then send the proxy response.
      Parameters:
        `request` - the request connected to the origin server

    - #### send

          Future<ProxyResponse> send​(HttpClientRequest request)

      Send this request to the origin server using the specified `request`.

      The returned future will be completed with the proxy response returned by the origin.

      Parameters:
        `request` - the request connected to the origin server

    - #### release

          ProxyRequest release()

      Release the proxy request and its associated resources

      The HTTP server request is resumed, no HTTP server response is sent.

      Returns:
        a reference to this, so the API can be used fluently

    - #### proxiedRequest

          HttpServerRequest proxiedRequest()

      Returns:
        the proxied HTTP server request

    - #### response

          ProxyResponse response()

      Create and return the proxy response.
      Returns:
        the proxy response