Class HttpParser


  • public final class HttpParser
    extends Object
    A basic parser for HTTP response headers. Handles status lines and authentication headers (WWW-Authenticate, Proxy-Authenticate).
    See Also:
    RFC 7230, RFC 7235
    • Method Detail

      • getAuthenticationHeaders

        public static List<AuthenticationChallenge> getAuthenticationHeaders​(List<String> reply,
                                                                             String authenticationHeader)
        Extract the authentication headers from the header lines. It is assumed that the first element in reply is the raw status line as received from the server. It is skipped. Line processing stops on the first empty line thereafter.
        Parameters:
        reply - The complete (header) lines of the HTTP response
        authenticationHeader - to look for (including the terminating ':'!)
        Returns:
        a list of AuthenticationChallenges found.