Class HttpServerDecoder
java.lang.Object
org.apache.mina.http.HttpServerDecoder
- All Implemented Interfaces:
ProtocolDecoder
The HTTP decoder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringKey for the number of bytes remaining to read for completing the bodystatic final PatternRegex to split cookie header following RFC6265 Section 5.4private static final StringKey for decoder current statestatic final PatternRegex to parse header name and valuestatic final PatternRegex to parse raw headers from bodystatic final PatternRegex to parse out key/value pairsprivate static final org.slf4j.Loggerstatic final PatternRegex to parse out parameters from query stringprivate static final StringKey for the partial HTTP requests headstatic final PatternRegex to parse out QueryString from HttpRequeststatic final PatternRegex to parse raw headers and bodystatic final PatternRegex to parse HttpRequest Request Line -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(IoSession session, IoBuffer msg, ProtocolDecoderOutput out) Decodes binary or protocol-specific content into higher-level message objects.voidReleases all resources related with this decoder.voidfinishDecode(IoSession session, ProtocolDecoderOutput out) Invoked when the specifiedsessionis closed.private HttpRequestImplparseHttpRequestHead(ByteBuffer buffer)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DECODER_STATE_ATT
-
PARTIAL_HEAD_ATT
-
BODY_REMAINING_BYTES
Key for the number of bytes remaining to read for completing the body- See Also:
-
REQUEST_LINE_PATTERN
Regex to parse HttpRequest Request Line -
QUERY_STRING_PATTERN
Regex to parse out QueryString from HttpRequest -
PARAM_STRING_PATTERN
Regex to parse out parameters from query string -
KEY_VALUE_PATTERN
Regex to parse out key/value pairs -
RAW_VALUE_PATTERN
Regex to parse raw headers and body -
HEADERS_BODY_PATTERN
Regex to parse raw headers from body -
HEADER_VALUE_PATTERN
Regex to parse header name and value -
COOKIE_SEPARATOR_PATTERN
Regex to split cookie header following RFC6265 Section 5.4
-
-
Constructor Details
-
HttpServerDecoder
public HttpServerDecoder()
-
-
Method Details
-
decode
Decodes binary or protocol-specific content into higher-level message objects. MINA invokesProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)method with read data, and then the decoder implementation puts decoded messages intoProtocolDecoderOutput.- Specified by:
decodein interfaceProtocolDecoder- Parameters:
session- The current Sessionmsg- the buffer to decodeout- TheProtocolDecoderOutputthat will receive the decoded message
-
finishDecode
Invoked when the specifiedsessionis closed. This method is useful when you deal with the protocol which doesn't specify the length of a message such as HTTP response withoutcontent-lengthheader. Implement this method to process the remaining data thatProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)method didn't process completely.- Specified by:
finishDecodein interfaceProtocolDecoder- Parameters:
session- The current Sessionout- TheProtocolDecoderOutputthat contains the decoded message- Throws:
Exception- if the read data violated protocol specification
-
dispose
Releases all resources related with this decoder.- Specified by:
disposein interfaceProtocolDecoder- Parameters:
session- The current Session- Throws:
Exception- if failed to dispose all resources
-
parseHttpRequestHead
-