HttpParser (Apache Tomcat 11.0.22 API Documentation)
Description: declaration: package: org.apache.tomcat.util.http.parser, class: HttpParser

# Class HttpParser

java.lang.Object
org.apache.tomcat.util.http.parser.HttpParser

public class HttpParser extends Object
HTTP header value parser implementation. Parsing HTTP headers as per RFC2616 is not always as simple as it first appears. For headers that only use tokens the simple approach will normally be sufficient. However, for the other headers, while simple code meets 99.9% of cases, there are often some edge cases that make things far more complicated. The purpose of this parser is to let the parser worry about the edge cases. It provides tolerant (where safe to do so) parsing of HTTP header values assuming that wrapped header lines have already been unwrapped. (The Tomcat header processing code does the unwrapping.)

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HttpParser(String relaxedPathChars, String relaxedQueryChars)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `isAbsolutePath(int c)`
  `boolean`
  `isAbsolutePathRelaxed(int c)`
  `static boolean`
  `isAlpha(int c)`
  `static boolean`
  `isControl(int c)`
  `static boolean`
  `isFieldContent(int c)`
  `static boolean`
  `isFieldVChar(int c)`
  `static boolean`
  `isHex(int c)`
  `static boolean`
  `isHttpProtocol(int c)`
  `static boolean`
  `isNotRequestTarget(int c)`
  `boolean`
  `isNotRequestTargetRelaxed(int c)`
  `static boolean`
  `isNumeric(int c)`
  `static boolean`
  `isQuery(int c)`
  `boolean`
  `isQueryRelaxed(int c)`
  `static boolean`
  `isScheme(int c)`
  `static boolean`
  `isScheme(String s)`
  Is the provided String a scheme as per RFC 3986?
  `static boolean`
  `isToken(int c)`
  `static boolean`
  `isToken(String s)`
  Is the provided String a token as per RFC 7230?
  `static boolean`
  `isUserInfo(int c)`
  `static boolean`
  `isWhiteSpace(int c)`
  `static String`
  `unquote(String input)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### HttpParser

    public HttpParser(String relaxedPathChars, String relaxedQueryChars)

- ## Method Details

  - ### isNotRequestTargetRelaxed

    public boolean isNotRequestTargetRelaxed(int c)

  - ### isAbsolutePathRelaxed

    public boolean isAbsolutePathRelaxed(int c)

  - ### isQueryRelaxed

    public boolean isQueryRelaxed(int c)

  - ### unquote

    public static String unquote(String input)

  - ### isToken

    public static boolean isToken(int c)

  - ### isToken

    public static boolean isToken(String s)
    Is the provided String a token as per RFC 7230?
    Note: token = 1 * tchar (RFC 7230)
    Since a token requires at least 1 tchar, `null` and the empty string (`""`) are not considered to be valid tokens.
    Parameters:
      `s` - The string to test
    Returns:
      `true` if the string is a valid token, otherwise `false`

  - ### isHex

    public static boolean isHex(int c)

  - ### isNotRequestTarget

    public static boolean isNotRequestTarget(int c)

  - ### isHttpProtocol

    public static boolean isHttpProtocol(int c)

  - ### isAlpha

    public static boolean isAlpha(int c)

  - ### isNumeric

    public static boolean isNumeric(int c)

  - ### isScheme

    public static boolean isScheme(int c)

  - ### isScheme

    public static boolean isScheme(String s)
    Is the provided String a scheme as per RFC 3986?
    Note: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
    Since a scheme requires at least 1 ALPHA, `null` and the empty string (`""`) are not considered to be valid tokens.
    Parameters:
      `s` - The string to test
    Returns:
      `true` if the string is a valid scheme, otherwise `false`

  - ### isUserInfo

    public static boolean isUserInfo(int c)

  - ### isWhiteSpace

    public static boolean isWhiteSpace(int c)

  - ### isAbsolutePath

    public static boolean isAbsolutePath(int c)

  - ### isQuery

    public static boolean isQuery(int c)

  - ### isControl

    public static boolean isControl(int c)

  - ### isFieldVChar

    public static boolean isFieldVChar(int c)

  - ### isFieldContent

    public static boolean isFieldContent(int c)