public abstract class AbstractHttpLogicHandler extends AbstractProxyLogicHandler
AbstractProxyLogicHandler implementations.
Provides HTTP request encoding/response decoding functionality.| Modifier and Type | Field and Description |
|---|---|
private int |
contentLength
The content length of the proxy response.
|
private static byte[] |
CRLF_DELIMITER |
private static java.lang.String |
DECODER |
private int |
entityBodyLimitPosition
Contains the limit of the entity body start in the
responseData IoBuffer. |
private int |
entityBodyStartPosition
Contains the position of the entity body start in the
responseData IoBuffer. |
private boolean |
hasChunkedData
A flag that indicates that this is a HTTP/1.1 response with chunked data.and that some chunks are missing.
|
private static byte[] |
HTTP_DELIMITER |
private static org.slf4j.Logger |
LOGGER |
private HttpProxyResponse |
parsedResponse
The parsed http proxy response
|
private IoBuffer |
responseData
Temporary buffer to accumulate the HTTP response from the proxy.
|
private boolean |
waitingChunkedData
A flag that indicates that some chunks of data are missing to complete the HTTP/1.1 response.
|
private boolean |
waitingFooters
A flag that indicates that chunked data has been read and that we're now reading the footers.
|
| Constructor and Description |
|---|
AbstractHttpLogicHandler(ProxyIoSession proxyIoSession)
Creates a new
AbstractHttpLogicHandler. |
| Modifier and Type | Method and Description |
|---|---|
protected HttpProxyResponse |
decodeResponse(java.lang.String response)
Parse a HTTP response from the proxy server.
|
abstract void |
handleResponse(HttpProxyResponse response)
Handles a HTTP response from the proxy server.
|
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoBuffer buf)
Handles incoming data during the handshake process.
|
private void |
reconnect(IoFilter.NextFilter nextFilter,
HttpProxyRequest request)
Method to reconnect to the proxy when it decides not to maintain the connection
during handshake.
|
void |
writeRequest(IoFilter.NextFilter nextFilter,
HttpProxyRequest request)
Calls writeRequest0(NextFilter, HttpProxyRequest) to write the request.
|
private void |
writeRequest0(IoFilter.NextFilter nextFilter,
HttpProxyRequest request)
Encodes a HTTP request and sends it to the proxy server.
|
closeSession, closeSession, enqueueWriteRequest, flushPendingWriteRequests, getProxyFilter, getProxyIoSession, getSession, isHandshakeComplete, setHandshakeComplete, writeDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoHandshakeprivate static final org.slf4j.Logger LOGGER
private static final java.lang.String DECODER
private static final byte[] HTTP_DELIMITER
private static final byte[] CRLF_DELIMITER
private IoBuffer responseData
private HttpProxyResponse parsedResponse
private int contentLength
private boolean hasChunkedData
private boolean waitingChunkedData
private boolean waitingFooters
private int entityBodyStartPosition
responseData IoBuffer.private int entityBodyLimitPosition
responseData IoBuffer.public AbstractHttpLogicHandler(ProxyIoSession proxyIoSession)
AbstractHttpLogicHandler.proxyIoSession - the ProxyIoSession in use.public void messageReceived(IoFilter.NextFilter nextFilter, IoBuffer buf) throws ProxyAuthException
nextFilter - the next filterbuf - the buffer holding received dataProxyAuthException - if authentication failspublic abstract void handleResponse(HttpProxyResponse response) throws ProxyAuthException
response - The response.ProxyAuthExceptionpublic void writeRequest(IoFilter.NextFilter nextFilter, HttpProxyRequest request)
nextFilter - the next filterrequest - the http requestprivate void writeRequest0(IoFilter.NextFilter nextFilter, HttpProxyRequest request)
nextFilter - the next filterrequest - the http requestprivate void reconnect(IoFilter.NextFilter nextFilter, HttpProxyRequest request)
nextFilter - the next filterrequest - the http requestprotected HttpProxyResponse decodeResponse(java.lang.String response) throws java.lang.Exception
response - The response string.java.lang.Exception