Class HttpParser
- java.lang.Object
- 
- org.apache.tomcat.util.http.parser.HttpParser
 
- 
 public class HttpParser extends java.lang.ObjectHTTP 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 SummaryConstructors Constructor Description HttpParser(java.lang.String relaxedPathChars, java.lang.String relaxedQueryChars)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanisAbsolutePath(int c)booleanisAbsolutePathRelaxed(int c)static booleanisAlpha(int c)static booleanisControl(int c)static booleanisHex(int c)static booleanisHttpProtocol(int c)static booleanisNotRequestTarget(int c)booleanisNotRequestTargetRelaxed(int c)static booleanisNumeric(int c)static booleanisQuery(int c)booleanisQueryRelaxed(int c)static booleanisToken(int c)static booleanisToken(java.lang.String s)Is the provided String a token as per RFC 7230?static booleanisUserInfo(int c)static java.lang.Stringunquote(java.lang.String input)
 
- 
- 
- 
Method Detail- 
isNotRequestTargetRelaxedpublic boolean isNotRequestTargetRelaxed(int c) 
 - 
isAbsolutePathRelaxedpublic boolean isAbsolutePathRelaxed(int c) 
 - 
isQueryRelaxedpublic boolean isQueryRelaxed(int c) 
 - 
unquotepublic static java.lang.String unquote(java.lang.String input) 
 - 
isTokenpublic static boolean isToken(int c) 
 - 
isTokenpublic static boolean isToken(java.lang.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,nulland the empty string ("") are not considered to be valid tokens.- Parameters:
- s- The string to test
- Returns:
- trueif the string is a valid token, otherwise- false
 
 - 
isHexpublic static boolean isHex(int c) 
 - 
isNotRequestTargetpublic static boolean isNotRequestTarget(int c) 
 - 
isHttpProtocolpublic static boolean isHttpProtocol(int c) 
 - 
isAlphapublic static boolean isAlpha(int c) 
 - 
isNumericpublic static boolean isNumeric(int c) 
 - 
isUserInfopublic static boolean isUserInfo(int c) 
 - 
isAbsolutePathpublic static boolean isAbsolutePath(int c) 
 - 
isQuerypublic static boolean isQuery(int c) 
 - 
isControlpublic static boolean isControl(int c) 
 
- 
 
-