public class DefaultHttpRequestParser extends AbstractMessageParser<ClassicHttpRequest>
SessionInputBuffer
.Constructor and Description |
---|
DefaultHttpRequestParser() |
DefaultHttpRequestParser(Http1Config http1Config) |
DefaultHttpRequestParser(LineParser lineParser,
HttpRequestFactory<ClassicHttpRequest> requestFactory,
Http1Config http1Config)
Creates new instance of DefaultHttpRequestParser.
|
Modifier and Type | Method and Description |
---|---|
protected IOException |
createConnectionClosedException()
Subclasses must override this method to generate an appropriate exception
in case of unexpected connection termination by the peer endpoint.
|
protected ClassicHttpRequest |
createMessage(CharArrayBuffer buffer)
Subclasses must override this method to generate an instance of
HttpMessage based on the initial input from the session buffer. |
ClassicHttpRequest |
parse(SessionInputBuffer buffer,
InputStream inputStream)
Generates an instance of
MessageHeaders from the given input stream.. |
parseHeaders, parseHeaders
public DefaultHttpRequestParser(LineParser lineParser, HttpRequestFactory<ClassicHttpRequest> requestFactory, Http1Config http1Config)
lineParser
- the line parser. If null
LazyLineParser.INSTANCE
will be used.requestFactory
- the response factory. If null
DefaultClassicHttpRequestFactory.INSTANCE
will be used.http1Config
- the message http1Config. If null
Http1Config.DEFAULT
will be used.public DefaultHttpRequestParser(Http1Config http1Config)
public DefaultHttpRequestParser()
protected IOException createConnectionClosedException()
AbstractMessageParser
createConnectionClosedException
in class AbstractMessageParser<ClassicHttpRequest>
public ClassicHttpRequest parse(SessionInputBuffer buffer, InputStream inputStream) throws IOException, HttpException
HttpMessageParser
MessageHeaders
from the given input stream..parse
in interface HttpMessageParser<ClassicHttpRequest>
parse
in class AbstractMessageParser<ClassicHttpRequest>
buffer
- Session input bufferinputStream
- Input streamIOException
- in case of an I/O errorHttpException
- in case of HTTP protocol violationprotected ClassicHttpRequest createMessage(CharArrayBuffer buffer) throws IOException, HttpException
AbstractMessageParser
HttpMessage
based on the initial input from the session buffer.
Usually this method is expected to read just the very first line or
the very first valid from the data stream and based on the input generate
an appropriate instance of HttpMessage
.
createMessage
in class AbstractMessageParser<ClassicHttpRequest>
buffer
- the session input buffer.IOException
- in case of an I/O error.HttpException
- in case of HTTP protocol violation.Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.