org.apache.mina.http

## Class HttpServerDecoder

- java.lang.Object
- - org.apache.mina.http.HttpServerDecoder

All Implemented Interfaces:
  ProtocolDecoder<ByteBuffer,HttpPdu,HttpDecoderState>

    public class HttpServerDecoder
    extends Object
    implements ProtocolDecoder<ByteBuffer,HttpPdu,HttpDecoderState>

In charge of decoding received bytes into HTTP message.

Author:
  Apache MINA Project

### Field Summary

Fields
`static Pattern` `COOKIE_SEPARATOR_PATTERN` Regex to split cookie header following RFC6265 Section 5.4
`static Pattern` `HEADER_VALUE_PATTERN` Regex to parse header name and value
`static Pattern` `HEADERS_BODY_PATTERN` Regex to parse raw headers from body
`static Pattern` `KEY_VALUE_PATTERN` Regex to parse out key/value pairs
`static Pattern` `PARAM_STRING_PATTERN` Regex to parse out parameters from query string
`static Pattern` `QUERY_STRING_PATTERN` Regex to parse out QueryString from HttpRequest
`static Pattern` `RAW_VALUE_PATTERN` Regex to parse raw headers and body
`static Pattern` `REQUEST_LINE_PATTERN` Regex to parse HttpRequest Request Line

### Constructor Summary

Constructors
Constructor and Description
`HttpServerDecoder()`

### Method Summary

Methods
`HttpDecoderState` `createDecoderState()` Create a new session context for this decoder
`HttpPdu` `decode(ByteBuffer msg, HttpDecoderState context)` Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT
`void` `finishDecode(HttpDecoderState context)` Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

### Methods inherited from class java.lang.Object

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

### Field Detail

#### REQUEST_LINE_PATTERN

    public static final Pattern REQUEST_LINE_PATTERN

Regex to parse HttpRequest Request Line

#### QUERY_STRING_PATTERN

    public static final Pattern QUERY_STRING_PATTERN

Regex to parse out QueryString from HttpRequest

#### PARAM_STRING_PATTERN

    public static final Pattern PARAM_STRING_PATTERN

Regex to parse out parameters from query string

#### KEY_VALUE_PATTERN

    public static final Pattern KEY_VALUE_PATTERN

Regex to parse out key/value pairs

#### RAW_VALUE_PATTERN

    public static final Pattern RAW_VALUE_PATTERN

Regex to parse raw headers and body

#### HEADERS_BODY_PATTERN

    public static final Pattern HEADERS_BODY_PATTERN

Regex to parse raw headers from body

#### HEADER_VALUE_PATTERN

    public static final Pattern HEADER_VALUE_PATTERN

Regex to parse header name and value

#### COOKIE_SEPARATOR_PATTERN

    public static final Pattern COOKIE_SEPARATOR_PATTERN

Regex to split cookie header following RFC6265 Section 5.4

### Constructor Detail

#### HttpServerDecoder

    public HttpServerDecoder()

### Method Detail

#### createDecoderState

    public HttpDecoderState createDecoderState()

Create a new session context for this decoder

Specified by:
  `createDecoderState` in interface `ProtocolDecoder<ByteBuffer,HttpPdu,HttpDecoderState>`
Returns:
  the newly created context

#### decode

    public HttpPdu decode(ByteBuffer msg,
                 HttpDecoderState context)

Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT

Specified by:
  `decode` in interface `ProtocolDecoder<ByteBuffer,HttpPdu,HttpDecoderState>`
Parameters:
  `msg` - the received message to decode
  `context` - the decoding context (will be stored in the session for the next decode call)
Returns:
  the decoded message or `null` if nothing was decoded

#### finishDecode

    public void finishDecode(HttpDecoderState context)

Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

Specified by:
  `finishDecode` in interface `ProtocolDecoder<ByteBuffer,HttpPdu,HttpDecoderState>`