public final class HttpProxyHandler extends ProxyHandler
HTTP users who need to connect to a message-forwarding HTTP proxy agent instead of a tunneling proxy should not use this handler.
Modifier and Type | Class and Description |
---|---|
static class |
HttpProxyHandler.HttpProxyConnectException
Specific case of a connection failure, which may include headers from the proxy.
|
ChannelHandler.Sharable
Constructor and Description |
---|
HttpProxyHandler(SocketAddress proxyAddress) |
HttpProxyHandler(SocketAddress proxyAddress,
HttpHeaders headers) |
HttpProxyHandler(SocketAddress proxyAddress,
HttpHeaders headers,
boolean ignoreDefaultPortsInConnectHostHeader) |
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) |
Modifier and Type | Method and 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() |
channelActive, channelInactive, channelRead, channelReadComplete, connect, connectFuture, connectTimeoutMillis, destinationAddress, exceptionCaught, exceptionMessage, flush, handlerAdded, isConnected, proxyAddress, sendToProxyServer, setConnectTimeoutMillis, write
bind, close, deregister, disconnect, read
channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
public HttpProxyHandler(SocketAddress proxyAddress)
public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers)
public HttpProxyHandler(SocketAddress proxyAddress, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
public HttpProxyHandler(SocketAddress proxyAddress, String username, String password)
public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers)
public HttpProxyHandler(SocketAddress proxyAddress, String username, String password, HttpHeaders headers, boolean ignoreDefaultPortsInConnectHostHeader)
public String protocol()
ProxyHandler
protocol
in class ProxyHandler
public String authScheme()
ProxyHandler
authScheme
in class ProxyHandler
public String username()
public String password()
protected void addCodec(ChannelHandlerContext ctx) throws Exception
ProxyHandler
addCodec
in class ProxyHandler
Exception
protected void removeEncoder(ChannelHandlerContext ctx) throws Exception
ProxyHandler
ProxyHandler.addCodec(ChannelHandlerContext)
.removeEncoder
in class ProxyHandler
Exception
protected void removeDecoder(ChannelHandlerContext ctx) throws Exception
ProxyHandler
ProxyHandler.addCodec(ChannelHandlerContext)
.removeDecoder
in class ProxyHandler
Exception
protected Object newInitialMessage(ChannelHandlerContext ctx) throws Exception
ProxyHandler
newInitialMessage
in class ProxyHandler
null
if the proxy server is expected to send the first message insteadException
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception
ProxyHandler
handleResponse
in class ProxyHandler
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 serverException
Copyright © 2008–2024 The Netty Project. All rights reserved.