Class AbstractHttpLogicHandler

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • DECODER

        private static final java.lang.String DECODER
      • HTTP_DELIMITER

        private static final byte[] HTTP_DELIMITER
      • CRLF_DELIMITER

        private static final byte[] CRLF_DELIMITER
      • responseData

        private IoBuffer responseData
        Temporary buffer to accumulate the HTTP response from the proxy.
      • parsedResponse

        private HttpProxyResponse parsedResponse
        The parsed http proxy response
      • contentLength

        private int contentLength
        The content length of the proxy response.
      • hasChunkedData

        private boolean hasChunkedData
        A flag that indicates that this is a HTTP/1.1 response with chunked data.and that some chunks are missing.
      • waitingChunkedData

        private boolean waitingChunkedData
        A flag that indicates that some chunks of data are missing to complete the HTTP/1.1 response.
      • waitingFooters

        private boolean waitingFooters
        A flag that indicates that chunked data has been read and that we're now reading the footers.
      • entityBodyStartPosition

        private int entityBodyStartPosition
        Contains the position of the entity body start in the responseData IoBuffer.
      • entityBodyLimitPosition

        private int entityBodyLimitPosition
        Contains the limit of the entity body start in the responseData IoBuffer.
    • Method Detail

      • messageReceived

        public void messageReceived​(IoFilter.NextFilter nextFilter,
                                    IoBuffer buf)
                             throws ProxyAuthException
        Handles incoming data during the handshake process. Should consume only the handshake data from the buffer, leaving any extra data in place.
        Parameters:
        nextFilter - the next filter
        buf - the buffer holding received data
        Throws:
        ProxyAuthException - if authentication fails
      • handleResponse

        public abstract void handleResponse​(HttpProxyResponse response)
                                     throws ProxyAuthException
        Handles a HTTP response from the proxy server.
        Parameters:
        response - The response.
        Throws:
        ProxyAuthException - If we get an error during the proxy authentication
      • writeRequest

        public void writeRequest​(IoFilter.NextFilter nextFilter,
                                 HttpProxyRequest request)
        Calls writeRequest0(NextFilter, HttpProxyRequest) to write the request. If needed a reconnection to the proxy is done previously.
        Parameters:
        nextFilter - the next filter
        request - the http request
      • writeRequest0

        private void writeRequest0​(IoFilter.NextFilter nextFilter,
                                   HttpProxyRequest request)
        Encodes a HTTP request and sends it to the proxy server.
        Parameters:
        nextFilter - the next filter
        request - the http request
      • reconnect

        private void reconnect​(IoFilter.NextFilter nextFilter,
                               HttpProxyRequest request)
        Method to reconnect to the proxy when it decides not to maintain the connection during handshake.
        Parameters:
        nextFilter - the next filter
        request - the http request
      • decodeResponse

        protected HttpProxyResponse decodeResponse​(java.lang.String response)
                                            throws java.lang.Exception
        Parse a HTTP response from the proxy server.
        Parameters:
        response - The response string.
        Returns:
        The decoded HttpResponse
        Throws:
        java.lang.Exception - If we get an error while decoding the response