GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Deprecated
  • Index
  • Search
  • Help
  • io.netty.handler.proxy
  • HttpProxyHandler

This view

  • Original page
  • New address

GeezerVison is showing netty.io — HttpProxyHandler (Netty API Reference (4.1.141.Final))

Class HttpProxyHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.proxy.ProxyHandler
io.netty.handler.proxy.HttpProxyHandler
All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler

public final class HttpProxyHandler extends ProxyHandler
Handler that establishes a blind forwarding proxy tunnel using HTTP/1.1 CONNECT request. It can be used to establish plaintext or secure tunnels.

HTTP users who need to connect to a message-forwarding HTTP proxy agent instead of a tunneling proxy should not use this handler.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    HttpProxyHandler.HttpProxyConnectException
    Specific case of a connection failure, which may include headers from the proxy.

    Nested classes/interfaces inherited from interface ChannelHandler

    ChannelHandler.Sharable
    Modifier and Type
    Interface
    Description
    static @interface 
    ChannelHandler.Sharable
    Indicates that the same instance of the annotated ChannelHandler can be added to one or more ChannelPipelines multiple times without a race condition.
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpProxyHandler(SocketAddress proxyAddress)
     
    HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers)
     
    HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
     
    HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader, boolean validateInitialHeaders)
     
    HttpProxyHandler(SocketAddress proxyAddress, String username, String password)
     
    HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers)
     
    HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
     
    HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader, boolean validateInitialHeaders)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addCodec(ChannelHandlerContext ctx)
    Adds the codec handlers required to communicate with the proxy server.
    String
    authScheme()
    Returns the name of the authentication scheme in use.
    protected boolean
    handleResponse(ChannelHandlerContext ctx, Object response)
    Handles the message received from the proxy server.
    protected Object
    newInitialMessage(ChannelHandlerContext ctx)
    Returns a new message that is sent at first time when the connection to the proxy server has been established.
    String
    password()
     
    String
    protocol()
    Returns the name of the proxy protocol in use.
    protected void
    removeDecoder(ChannelHandlerContext ctx)
    Removes the decoders added in ProxyHandler.addCodec(ChannelHandlerContext).
    protected void
    removeEncoder(ChannelHandlerContext ctx)
    Removes the encoders added in ProxyHandler.addCodec(ChannelHandlerContext).
    String
    username()
     

    Methods inherited from class ProxyHandler

    channelActive, channelInactive, channelRead, channelReadComplete, connect, connectFuture, connectTimeoutMillis, destinationAddress, exceptionCaught, exceptionMessage, flush, handlerAdded, handlerRemoved, isConnected, proxyAddress, sendToProxyServer, setConnectTimeoutMillis, write
    Modifier and Type
    Method
    Description
    final void
    channelActive(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelActive() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelInactive(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelInactive() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelRead(ChannelHandlerContext ctx, Object msg)
    Calls ChannelHandlerContext.fireChannelRead(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    channelReadComplete(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelReadComplete() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    final void
    connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.connect(SocketAddress, SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    final Future<Channel>
    connectFuture()
    Returns a Future that is notified when the connection to the destination has been established or the connection attempt has failed.
    final long
    connectTimeoutMillis()
    Returns the connect timeout in millis.
    final <T extends SocketAddress>
    T
    destinationAddress()
    Returns the address of the destination to connect to via the proxy server.
    final void
    exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
    Calls ChannelHandlerContext.fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline.
    protected final String
    exceptionMessage(String msg)
    Decorates the specified exception message with the common information such as the current protocol, authentication scheme, proxy address, and destination address.
    final void
    flush(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.flush() to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    final void
    handlerAdded(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    void
    handlerRemoved(ChannelHandlerContext ctx)
    Do nothing by default, sub-classes may override this method.
    final boolean
    isConnected()
    Returns true if and only if the connection to the destination has been established successfully.
    final <T extends SocketAddress>
    T
    proxyAddress()
    Returns the address of the proxy server.
    protected final void
    sendToProxyServer(Object msg)
    Sends the specified message to the proxy server.
    final void
    setConnectTimeoutMillis(long connectTimeoutMillis)
    Sets the connect timeout in millis.
    final void
    write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
    Calls ChannelOutboundInvoker.write(Object, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelDuplexHandler

    bind, close, deregister, disconnect, read
    Modifier and Type
    Method
    Description
    void
    bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelPromise promise)
    Calls ChannelOutboundInvoker.bind(SocketAddress, ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    close(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.close(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    deregister(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.deregister(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
    Calls ChannelOutboundInvoker.disconnect(ChannelPromise) to forward to the next ChannelOutboundHandler in the ChannelPipeline.
    void
    read(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.read() to forward to the next ChannelOutboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelInboundHandlerAdapter

    channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
    Modifier and Type
    Method
    Description
    void
    channelRegistered(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelRegistered() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    channelUnregistered(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelUnregistered() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    channelWritabilityChanged(ChannelHandlerContext ctx)
    Calls ChannelHandlerContext.fireChannelWritabilityChanged() to forward to the next ChannelInboundHandler in the ChannelPipeline.
    void
    userEventTriggered(ChannelHandlerContext ctx, Object evt)
    Calls ChannelHandlerContext.fireUserEventTriggered(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline.

    Methods inherited from class ChannelHandlerAdapter

    ensureNotSharable, isSharable
    Modifier and Type
    Method
    Description
    protected void
    ensureNotSharable()
    Throws IllegalStateException if ChannelHandlerAdapter.isSharable() returns true
    boolean
    isSharable()
    Return true if the implementation is ChannelHandler.Sharable and so can be added to different ChannelPipelines.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader, boolean validateInitialHeaders)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, String username, String password)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
    • HttpProxyHandler

      public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader, boolean validateInitialHeaders)
  • Method Details

    • protocol

      public String protocol()
      Description copied from class: ProxyHandler
      Returns the name of the proxy protocol in use.
      Specified by:
      protocol in class ProxyHandler
    • authScheme

      public String authScheme()
      Description copied from class: ProxyHandler
      Returns the name of the authentication scheme in use.
      Specified by:
      authScheme in class ProxyHandler
    • username

      public String username()
    • password

      public String password()
    • addCodec

      protected void addCodec(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ProxyHandler
      Adds the codec handlers required to communicate with the proxy server.
      Specified by:
      addCodec in class ProxyHandler
      Throws:
      Exception
    • removeEncoder

      protected void removeEncoder(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ProxyHandler
      Removes the encoders added in ProxyHandler.addCodec(ChannelHandlerContext).
      Specified by:
      removeEncoder in class ProxyHandler
      Throws:
      Exception
    • removeDecoder

      protected void removeDecoder(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ProxyHandler
      Removes the decoders added in ProxyHandler.addCodec(ChannelHandlerContext).
      Specified by:
      removeDecoder in class ProxyHandler
      Throws:
      Exception
    • newInitialMessage

      protected Object newInitialMessage(ChannelHandlerContext ctx) throws Exception
      Description copied from class: ProxyHandler
      Returns a new message that is sent at first time when the connection to the proxy server has been established.
      Specified by:
      newInitialMessage in class ProxyHandler
      Returns:
      the initial message, or null if the proxy server is expected to send the first message instead
      Throws:
      Exception
    • handleResponse

      protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception
      Description copied from class: ProxyHandler
      Handles the message received from the proxy server.
      Specified by:
      handleResponse in class ProxyHandler
      Returns:
      true if the connection to the destination has been established, false if the connection to the destination has not been established and more messages are expected from the proxy server
      Throws:
      Exception
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.