Class RedirectProtocolHandler

    • Constructor Detail

      • RedirectProtocolHandler

        public RedirectProtocolHandler​(HttpClient client)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface ProtocolHandler
        Returns:
        a unique name among protocol handlers
      • accept

        public boolean accept​(Request request,
                              Response response)
        Description copied from interface: ProtocolHandler

        Inspects the given request and response to detect whether this protocol handler should handle them.

        For example, a redirect protocol handler can inspect the response code and return true if it is a redirect response code.

        This method is being called just after the response line has been parsed, and before the response headers are available.

        Specified by:
        accept in interface ProtocolHandler
        Parameters:
        request - the request to accept
        response - the response to accept
        Returns:
        true if this protocol handler can handle the given request and response
      • onHeader

        public boolean onHeader​(Response response,
                                HttpField field)
        Description copied from interface: Response.HeaderListener
        Callback method invoked when a response header has been received, returning whether the header should be processed or not.
        Specified by:
        onHeader in interface Response.HeaderListener
        Overrides:
        onHeader in class Response.Listener.Adapter
        Parameters:
        response - the response containing the response line data and the headers so far
        field - the header received
        Returns:
        true to process the header, false to skip processing of the header