Class ProxyHandler
java.lang.Object
io.undertow.server.handlers.proxy.ProxyHandler
- All Implemented Interfaces:
HttpHandler
An HTTP handler which proxies content to a remote server.
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
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProxyHandler
(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. -
Method Summary
Modifier and TypeMethodDescriptionaddRequestHeader
(HttpString header, ExchangeAttribute attribute) Deprecated.addRequestHeader
(HttpString header, String value) Deprecated.addRequestHeader
(HttpString header, String attribute, ClassLoader classLoader) Deprecated.static ProxyHandler.Builder
builder()
int
void
handleRequest
(HttpServerExchange exchange) Handle the request.boolean
boolean
removeRequestHeader
(HttpString header) Deprecated.setMaxConnectionRetries
(int maxConnectionRetries) Deprecated.setReuseXForwarded
(boolean reuseXForwarded) Deprecated.setRewriteHostHeader
(boolean rewriteHostHeader) Deprecated.toString()
-
Field Details
-
UTF_8
-
-
Constructor Details
-
ProxyHandler
Deprecated. -
ProxyHandler
@Deprecated public ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next, boolean rewriteHostHeader, boolean reuseXForwarded) Deprecated.- Parameters:
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.
-
ProxyHandler
@Deprecated public ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next, boolean rewriteHostHeader, boolean reuseXForwarded, int maxConnectionRetries) Deprecated.- Parameters:
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
-
-
ProxyHandler
Deprecated.
-
-
Method Details
-
handleRequest
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
Exception
-
addRequestHeader
Deprecated.Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed.- Parameters:
header
- The header nameattribute
- The header value attribute.- Returns:
- this
-
addRequestHeader
Deprecated.Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed.- Parameters:
header
- The header namevalue
- The header value attribute.- Returns:
- this
-
addRequestHeader
@Deprecated public ProxyHandler addRequestHeader(HttpString header, String attribute, ClassLoader classLoader) Deprecated.Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed.The attribute value will be parsed, and the resulting exchange attribute will be used to create the actual header value.
- Parameters:
header
- The header nameattribute
- The header value attribute.- Returns:
- this
-
removeRequestHeader
Deprecated.Removes a request header- Parameters:
header
- the header- Returns:
- this
-
getProxyClient
-
toString
-
setMaxConnectionRetries
Deprecated. -
isRewriteHostHeader
public boolean isRewriteHostHeader() -
setRewriteHostHeader
Deprecated. -
isReuseXForwarded
public boolean isReuseXForwarded() -
setReuseXForwarded
Deprecated. -
getMaxConnectionRetries
public int getMaxConnectionRetries() -
getIdempotentRequestPredicate
-
builder
-