Class ProxyRequest

java.lang.Object
io.vertx.mutiny.httpproxy.ProxyRequest
All Implemented Interfaces:
MutinyDelegate

public class ProxyRequest extends Object implements MutinyDelegate
Handles the interoperability of the request between the user agent and the origin.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Julien Viet
See Also:
  • ProxyRequest
  • Field Details

  • Constructor Details

    • ProxyRequest

      public ProxyRequest(io.vertx.httpproxy.ProxyRequest delegate)
      Create a new instance of ProxyRequest delegating to the given (non-null) instance of ProxyRequest.
    • ProxyRequest

      public ProxyRequest(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.httpproxy.ProxyRequest getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • proxy

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> proxy(HttpClientRequest request)
      Proxy this request to the origin server using the specified request and then send the proxy response.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      request - the request connected to the origin server
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.httpproxy.ProxyRequest#proxy(HttpClientRequest)
    • proxyAndAwait

      public void proxyAndAwait(HttpClientRequest request)
      Proxy this request to the origin server using the specified request and then send the proxy response.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      request - the request connected to the origin server
      See Also:
      • io.vertx.httpproxy.ProxyRequest#proxy(HttpClientRequest)
    • proxyAndForget

      public ProxyRequest proxyAndForget(HttpClientRequest request)
      Proxy this request to the origin server using the specified request and then send the proxy response.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      request - the request connected to the origin server
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.httpproxy.ProxyRequest#proxy(HttpClientRequest)
    • send

      @CheckReturnValue public io.smallrye.mutiny.Uni<ProxyResponse> send(HttpClientRequest request)
      Send this request to the origin server using the specified request.

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

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      request - the request connected to the origin server
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.httpproxy.ProxyRequest#send(HttpClientRequest)
    • sendAndAwait

      public ProxyResponse sendAndAwait(HttpClientRequest request)
      Send this request to the origin server using the specified request.

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

      Unlike the bare Vert.x variant, this method returns a ProxyResponse. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      request - the request connected to the origin server
      Returns:
      The operation result
      See Also:
      • io.vertx.httpproxy.ProxyRequest#send(HttpClientRequest)
    • sendAndForget

      public ProxyRequest sendAndForget(HttpClientRequest request)
      Send this request to the origin server using the specified request.

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

      Unlike the bare Vert.x variant, this method ignores the ProxyResponse result or any failure.

      Parameters:
      request - the request connected to the origin server
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.httpproxy.ProxyRequest#send(HttpClientRequest)
    • reverseProxy

      public 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
    • reverseProxy

      public static ProxyRequest reverseProxy(HttpServerRequest proxiedRequest, io.vertx.httpproxy.ForwardedHeadersOptions forwardedHeadersOptions)
      Like reverseProxy(HttpServerRequest) but using specific For
    • version

      public io.vertx.core.http.HttpVersion version()
      Returns:
      the HTTP version of the proxied request
    • absoluteURI

      public String absoluteURI()
      Returns:
      the absolute URI of the proxied request
    • getMethod

      public io.vertx.core.http.HttpMethod getMethod()
      Returns:
      the HTTP method to be sent to the origin server.
    • setMethod

      public ProxyRequest setMethod(io.vertx.core.http.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

      public String getURI()
      Returns:
      the request URI to be sent to the origin server.
    • setURI

      public 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

      public Body getBody()
      Returns:
      the request body to be sent to the origin server.
    • setBody

      public 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

      public ProxyRequest setAuthority(io.vertx.core.net.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

      public io.vertx.core.net.HostAndPort getAuthority()
      Returns:
      the request authority, for HTTP2 the :authority pseudo header otherwise the Host header
    • headers

      public io.vertx.core.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
    • release

      public 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

      public HttpServerRequest proxiedRequest()
      Returns:
      the proxied HTTP server request
    • response

      public ProxyResponse response()
      Create and return the proxy response.
      Returns:
      the proxy response
    • newInstance

      public static ProxyRequest newInstance(io.vertx.httpproxy.ProxyRequest delegate)
      Creates a new instance of the ProxyRequest.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object