public final class ProxyHandler extends 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 and Description |
---|---|
static class | ProxyHandler.Builder |
Constructor and Description |
---|
ProxyHandler(ProxyClient proxyClient, HttpHandler next) Deprecated. |
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. |
Modifier and Type | Method and Description |
---|---|
ProxyHandler | addRequestHeader(HttpString header, ExchangeAttribute attribute) Deprecated. |
ProxyHandler | addRequestHeader(HttpString header, String value) Deprecated. |
ProxyHandler | addRequestHeader(HttpString header, String attribute, 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. |
public static final String UTF_8
@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 Exception
HttpHandler
handleRequest
in interface HttpHandler
exchange
- the HTTP request/response exchangeException
@Deprecated public ProxyHandler addRequestHeader(HttpString header, ExchangeAttribute attribute)
header
- The header nameattribute
- The header value attribute.@Deprecated public ProxyHandler addRequestHeader(HttpString header, String value)
header
- The header namevalue
- The header value attribute.@Deprecated public ProxyHandler addRequestHeader(HttpString header, String attribute, 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 © 2020 JBoss by Red Hat. All rights reserved.