Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.43
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.util.http.parser
Class HttpParser

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

    public class HttpParser

extends java.lang.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.) Provides parsing of the following HTTP header values as per RFC 2616: - Authorization for DIGEST authentication - MediaType (used for Content-Type header) Support for additional headers will be provided as required.

Constructor Summary
`HttpParser()`

Method Summary
`static java.util.Map<java.lang.String,java.lang.String>` | `parseAuthorizationDigest(java.io.StringReader input)` Parses an HTTP Authorization header for DIGEST authentication as per RFC 2617 section 3.2.2.
`static MediaType` | `parseMediaType(java.io.StringReader input)`
`static java.lang.String` | `unquote(java.lang.String input)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HttpParser

    public HttpParser()

Method Detail

### parseAuthorizationDigest

    public static java.util.Map<java.lang.String,java.lang.String> parseAuthorizationDigest(java.io.StringReader input)
                                                                                     throws java.lang.IllegalArgumentException,
                                                                                            java.io.IOException

  Parses an HTTP Authorization header for DIGEST authentication as per RFC 2617 section 3.2.2.

  Parameters:
    `input` - The header value to parse
  Returns:
    A map of directives and values as `String`s or `null` if a parsing error occurs. Although the values returned are `String`s they will have been validated to ensure that they conform to RFC 2617.
  Throws:
    `java.lang.IllegalArgumentException` - If the header does not conform to RFC 2617
    `java.io.IOException` - If an error occurs while reading the input

### parseMediaType

    public static MediaType parseMediaType(java.io.StringReader input)
                                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### unquote

    public static java.lang.String unquote(java.lang.String input)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.43
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.