Package org.apache.hc.core5.http.impl.io
Class DefaultHttpRequestParser
java.lang.Object
org.apache.hc.core5.http.impl.io.AbstractMessageParser<ClassicHttpRequest>
org.apache.hc.core5.http.impl.io.DefaultHttpRequestParser
- All Implemented Interfaces:
HttpMessageParser<ClassicHttpRequest>
HTTP request parser that obtain its input from an instance
of
SessionInputBuffer
.- Since:
- 4.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpRequestParser
(Http1Config http1Config) DefaultHttpRequestParser
(LineParser lineParser, HttpRequestFactory<ClassicHttpRequest> requestFactory, Http1Config http1Config) Creates new instance of DefaultHttpRequestParser. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClassicHttpRequest
createMessage
(CharArrayBuffer buffer) Subclasses must override this method to generate an instance ofHttpMessage
based on the initial input from the session buffer.parse
(SessionInputBuffer buffer, InputStream inputStream) Generates an instance ofMessageHeaders
from the given input stream..Methods inherited from class org.apache.hc.core5.http.impl.io.AbstractMessageParser
createConnectionClosedException, getLineParser, parseHeaders, parseHeaders
-
Field Details
-
requestFactory
-
-
Constructor Details
-
DefaultHttpRequestParser
public DefaultHttpRequestParser(LineParser lineParser, HttpRequestFactory<ClassicHttpRequest> requestFactory, Http1Config http1Config) Creates new instance of DefaultHttpRequestParser.- Parameters:
lineParser
- the line parser. Ifnull
LazyLineParser.INSTANCE
will be used.requestFactory
- the response factory. Ifnull
DefaultClassicHttpRequestFactory.INSTANCE
will be used.http1Config
- the message http1Config. Ifnull
Http1Config.DEFAULT
will be used.- Since:
- 4.3
-
DefaultHttpRequestParser
- Since:
- 4.3
-
DefaultHttpRequestParser
public DefaultHttpRequestParser()- Since:
- 4.3
-
-
Method Details
-
parse
public ClassicHttpRequest parse(SessionInputBuffer buffer, InputStream inputStream) throws IOException, HttpException Description copied from interface:HttpMessageParser
Generates an instance ofMessageHeaders
from the given input stream..- Specified by:
parse
in interfaceHttpMessageParser<ClassicHttpRequest>
- Overrides:
parse
in classAbstractMessageParser<ClassicHttpRequest>
- Parameters:
buffer
- Session input bufferinputStream
- Input stream- Returns:
- HTTP message head or
null
if the input stream has been closed by the opposite endpoint. - Throws:
IOException
- in case of an I/O errorHttpException
- in case of HTTP protocol violation
-
createMessage
protected ClassicHttpRequest createMessage(CharArrayBuffer buffer) throws IOException, HttpException Description copied from class:AbstractMessageParser
Subclasses must override this method to generate an instance ofHttpMessage
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
.- Specified by:
createMessage
in classAbstractMessageParser<ClassicHttpRequest>
- Parameters:
buffer
- the session input buffer.- Returns:
- HTTP message based on the input from the session buffer.
- Throws:
IOException
- in case of an I/O error.HttpException
- in case of HTTP protocol violation.
-