Class ProxyHandler

  • All Implemented Interfaces:
    HttpHandler

    public final class ProxyHandler
    extends Object
    implements 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
    • Field Detail

      • UTF_8

        public static final String UTF_8
    • Constructor Detail

      • 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 call
        maxRequestTime - the maximum amount of time to allow the request to be processed
        next - the next handler in line
        rewriteHostHeader - 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 call
        maxRequestTime - the maximum amount of time to allow the request to be processed
        next - the next handler in line
        rewriteHostHeader - 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 -
    • Method Detail

      • addRequestHeader

        @Deprecated
        public ProxyHandler addRequestHeader​(HttpString header,
                                             ExchangeAttribute attribute)
        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 name
        attribute - The header value attribute.
        Returns:
        this
      • addRequestHeader

        @Deprecated
        public ProxyHandler addRequestHeader​(HttpString header,
                                             String value)
        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 name
        value - 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 name
        attribute - The header value attribute.
        Returns:
        this
      • removeRequestHeader

        @Deprecated
        public ProxyHandler removeRequestHeader​(HttpString header)
        Deprecated.
        Removes a request header
        Parameters:
        header - the header
        Returns:
        this
      • setMaxConnectionRetries

        @Deprecated
        public ProxyHandler setMaxConnectionRetries​(int maxConnectionRetries)
        Deprecated.
      • isRewriteHostHeader

        public boolean isRewriteHostHeader()
      • setRewriteHostHeader

        @Deprecated
        public ProxyHandler setRewriteHostHeader​(boolean rewriteHostHeader)
        Deprecated.
      • isReuseXForwarded

        public boolean isReuseXForwarded()
      • getMaxConnectionRetries

        public int getMaxConnectionRetries()
      • getIdempotentRequestPredicate

        public Predicate getIdempotentRequestPredicate()