Interface ProxyRequest
public interface ProxyRequest
Handles the interoperability of the request between the user agent and the origin.
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptiongetBody()getURI()headers()proxy(HttpClientRequest request) Proxy this request to the origin server using the specifiedrequestand then send the proxy response.putHeader(CharSequence name, CharSequence value) Put an HTTP header.release()Release the proxy request and its associated resources.response()Create and return the proxy response.static ProxyRequestreverseProxy(HttpServerRequest proxiedRequest) Create a newProxyRequestinstance, the proxied request will be paused.static ProxyRequestreverseProxy(HttpServerRequest proxiedRequest, ForwardedHeadersOptions forwardedHeadersOptions) LikereverseProxy(HttpServerRequest)but using specific Forsend(HttpClientRequest request) Send this request to the origin server using the specifiedrequest.setAuthority(HostAndPort authority) Set the request authority.Set the request body to be sent to the origin server.setMethod(HttpMethod method) Set the HTTP method to be sent to the origin server.Set the request URI to be sent to the origin server.version()
-
Method Details
-
reverseProxy
Create a newProxyRequestinstance, the proxied request will be paused.- Parameters:
proxiedRequest- theHttpServerRequestthat is proxied- Returns:
- a reference to this, so the API can be used fluently
-
reverseProxy
static ProxyRequest reverseProxy(HttpServerRequest proxiedRequest, ForwardedHeadersOptions forwardedHeadersOptions) LikereverseProxy(HttpServerRequest)but using specific For -
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
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
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
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
Set the request authority.- for HTTP/1 the Host header
- for HTTP/2 the :authority pseudo header
- 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
Put an HTTP header.- Parameters:
name- The header namevalue- The header value- Returns:
- a reference to this, so the API can be used fluently
-
proxy
Proxy this request to the origin server using the specifiedrequestand then send the proxy response.- Parameters:
request- the request connected to the origin server
-
send
Send this request to the origin server using the specifiedrequest.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
-