Top Description Inners Fields Constructors Methods
io.undertow.server.handlers.proxy

public final Class ProxyHandler

extends Object
implements HttpHandler
Class Inheritance
All Implemented Interfaces
io.undertow.server.HttpHandler
Imports
io.undertow.UndertowLogger, .UndertowMessages, io.undertow.attribute.ExchangeAttribute, .ExchangeAttributes, io.undertow.client.ClientCallback, .ClientConnection, .ClientExchange, .ClientRequest, .ClientResponse, .ContinueNotification, .ProxiedRequestAttachments, .PushCallback, io.undertow.client.http2.Http2ClientConnection, io.undertow.connector.ByteBufferPool, io.undertow.io.IoCallback, .Sender, io.undertow.predicate.IdempotentPredicate, .Predicate, io.undertow.server.ExchangeCompletionListener, .HttpHandler, .HttpServerExchange, .HttpUpgradeListener, .RenegotiationRequiredException, .SSLSessionInfo, io.undertow.server.handlers.ResponseCodeHandler, io.undertow.server.protocol.http.HttpAttachments, .HttpContinue, io.undertow.util.Attachable, .AttachmentKey, .Certificates, .Cookies, .CopyOnWriteMap, .HeaderMap, .HeaderValues, .Headers, .HttpString, .NetworkUtils, .Protocols, .SameThreadExecutor, .StatusCodes, .Transfer, .WorkerUtils, org.jboss.logging.Logger, org.xnio.ChannelExceptionHandler, .ChannelListener, .ChannelListeners, .IoUtils, .OptionMap, .StreamConnection, .XnioExecutor, org.xnio.channels.StreamSinkChannel, javax.net.ssl.SSLPeerUnverifiedException, java.io.Closeable, .IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.channels.Channel, java.nio.charset.StandardCharsets, java.security.cert.Certificate, .CertificateEncodingException, java.util.Collections, .List, .Map, java.util.concurrent.TimeUnit, java.util.stream.Collectors

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 and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
private static class
private static class
private static class
private class
private static class

Field Summary

Modifier and TypeField and Description
private static final AttachmentKey<ProxyConnection>
private static final int
private static final AttachmentKey<HttpServerExchange>
private final Predicate
private static final Logger
private volatile int
private final int
private final HttpHandler
private final ProxyClient
private final Map<HttpString, ExchangeAttribute>
requestHeaders

Map of additional headers to add to the request.

private volatile boolean
private volatile boolean
private static final AttachmentKey<XnioExecutor.Key>
public static final String

Constructor Summary

AccessConstructor and Description
public
ProxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next)
Deprecated

public
ProxyHandler(ProxyClient
the client to use to make the proxy call
proxyClient
,
int
the maximum amount of time to allow the request to be processed
maxRequestTime
,
HttpHandler
the next handler in line
next
,
boolean
should the HOST header be rewritten to use the target host of the call.
rewriteHostHeader
,
boolean
should any existing X-Forwarded-For header be used or should it be overwritten.
reuseXForwarded
)
Deprecated

public
ProxyHandler(ProxyClient
the client to use to make the proxy call
proxyClient
,
int
the maximum amount of time to allow the request to be processed
maxRequestTime
,
HttpHandler
the next handler in line
next
,
boolean
should the HOST header be rewritten to use the target host of the call.
rewriteHostHeader
,
boolean
should any existing X-Forwarded-For header be used or should it be overwritten.
reuseXForwarded
,
int maxConnectionRetries)
Deprecated

public
ProxyHandler(ProxyClient proxyClient, HttpHandler next)
Deprecated

pack-priv

Method Summary

Modifier and TypeMethod and Description
public ProxyHandler

Returns:

this
addRequestHeader
(final HttpString
The header name
header
,
final ExchangeAttribute
The header value attribute.
attribute
)
Deprecated

Adds a request header to the outgoing request.

public ProxyHandler

Returns:

this
addRequestHeader
(final HttpString
The header name
header
,
final String
The header value attribute.
value
)
Deprecated

Adds a request header to the outgoing request.

public ProxyHandler

Returns:

this
addRequestHeader
(final HttpString
The header name
header
,
final String
The header value attribute.
attribute
,
final ClassLoader classLoader)
Deprecated

Adds a request header to the outgoing request.

public static ProxyHandler.Builder
pack-priv static void
copyHeaders(final HttpServerExchange exchange, final HeaderMap to, final HeaderMap from)

public Predicate
public int
public ProxyClient
pack-priv static void
handleFailure(HttpServerExchange exchange, ProxyHandler.ProxyClientHandler proxyClientHandler, Predicate idempotentRequestPredicate, IOException e)

public void
handleRequest(final HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

public boolean
public boolean
public ProxyHandler

Returns:

this
removeRequestHeader
(final HttpString
the header
header
)
Deprecated

Removes a request header

public ProxyHandler
setMaxConnectionRetries(int maxConnectionRetries)
Deprecated

public ProxyHandler
setReuseXForwarded(boolean reuseXForwarded)
Deprecated

public ProxyHandler
setRewriteHostHeader(boolean rewriteHostHeader)
Deprecated

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait