HttpHandlerpublic final class ProxyHandler extends java.lang.Object implements HttpHandler
This handler acts like a filter. The ProxyClient has a chance to decide if it
knows how to proxy the request. If it does then it will provide a connection that can
used to connect to the remote server, otherwise the next handler will be invoked and the
request will proceed as normal.
This handler uses non blocking IO
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ProxyHandler.Builder |
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
UTF_8 |
| Constructor | Description |
|---|---|
ProxyHandler(ProxyClient proxyClient,
int maxRequestTime,
HttpHandler next) |
Deprecated.
|
ProxyHandler(ProxyClient proxyClient,
int maxRequestTime,
HttpHandler next,
boolean rewriteHostHeader,
boolean reuseXForwarded) |
Deprecated.
|
ProxyHandler(ProxyClient proxyClient,
int maxRequestTime,
HttpHandler next,
boolean rewriteHostHeader,
boolean reuseXForwarded,
int maxConnectionRetries) |
Deprecated.
|
ProxyHandler(ProxyClient proxyClient,
HttpHandler next) |
Deprecated.
|
| Modifier and Type | Method | Description |
|---|---|---|
ProxyHandler |
addRequestHeader(HttpString header,
ExchangeAttribute attribute) |
Deprecated.
|
ProxyHandler |
addRequestHeader(HttpString header,
java.lang.String value) |
Deprecated.
|
ProxyHandler |
addRequestHeader(HttpString header,
java.lang.String attribute,
java.lang.ClassLoader classLoader) |
Deprecated.
|
static ProxyHandler.Builder |
builder() |
|
Predicate |
getIdempotentRequestPredicate() |
|
int |
getMaxConnectionRetries() |
|
ProxyClient |
getProxyClient() |
|
void |
handleRequest(HttpServerExchange exchange) |
Handle the request.
|
boolean |
isReuseXForwarded() |
|
boolean |
isRewriteHostHeader() |
|
ProxyHandler |
removeRequestHeader(HttpString header) |
Deprecated.
|
ProxyHandler |
setMaxConnectionRetries(int maxConnectionRetries) |
Deprecated.
|
ProxyHandler |
setReuseXForwarded(boolean reuseXForwarded) |
Deprecated.
|
ProxyHandler |
setRewriteHostHeader(boolean rewriteHostHeader) |
Deprecated.
|
@Deprecated public ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next)
@Deprecated public ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next, boolean rewriteHostHeader, boolean reuseXForwarded)
proxyClient - the client to use to make the proxy callmaxRequestTime - the maximum amount of time to allow the request to be processednext - the next handler in linerewriteHostHeader - should the HOST header be rewritten to use the target host of the call.reuseXForwarded - should any existing X-Forwarded-For header be used or should it be overwritten.@Deprecated public ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next, boolean rewriteHostHeader, boolean reuseXForwarded, int maxConnectionRetries)
proxyClient - the client to use to make the proxy callmaxRequestTime - the maximum amount of time to allow the request to be processednext - the next handler in linerewriteHostHeader - should the HOST header be rewritten to use the target host of the call.reuseXForwarded - should any existing X-Forwarded-For header be used or should it be overwritten.maxConnectionRetries - @Deprecated public ProxyHandler(ProxyClient proxyClient, HttpHandler next)
public void handleRequest(HttpServerExchange exchange) throws java.lang.Exception
HttpHandlerhandleRequest in interface HttpHandlerexchange - the HTTP request/response exchangejava.lang.Exception@Deprecated public ProxyHandler addRequestHeader(HttpString header, ExchangeAttribute attribute)
header - The header nameattribute - The header value attribute.@Deprecated public ProxyHandler addRequestHeader(HttpString header, java.lang.String value)
header - The header namevalue - The header value attribute.@Deprecated public ProxyHandler addRequestHeader(HttpString header, java.lang.String attribute, java.lang.ClassLoader classLoader)
The attribute value will be parsed, and the resulting exchange attribute will be used to create the actual header value.
header - The header nameattribute - The header value attribute.@Deprecated public ProxyHandler removeRequestHeader(HttpString header)
header - the headerpublic ProxyClient getProxyClient()
@Deprecated public ProxyHandler setMaxConnectionRetries(int maxConnectionRetries)
public boolean isRewriteHostHeader()
@Deprecated public ProxyHandler setRewriteHostHeader(boolean rewriteHostHeader)
public boolean isReuseXForwarded()
@Deprecated public ProxyHandler setReuseXForwarded(boolean reuseXForwarded)
public int getMaxConnectionRetries()
public Predicate getIdempotentRequestPredicate()
public static ProxyHandler.Builder builder()
Copyright © 2018. All rights reserved.