Package org.apache.hc.core5.http.impl.io
Class DefaultHttpResponseParser
java.lang.Object
org.apache.hc.core5.http.impl.io.AbstractMessageParser<ClassicHttpResponse>
org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser
- All Implemented Interfaces:
HttpMessageParser<ClassicHttpResponse>
HTTP response parser that obtain its input from an instance
of
SessionInputBuffer
.- Since:
- 4.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpResponseParser
(Http1Config http1Config) DefaultHttpResponseParser
(LineParser lineParser, HttpResponseFactory<ClassicHttpResponse> responseFactory, Http1Config http1Config) Creates new instance of DefaultHttpResponseParser. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClassicHttpResponse
createMessage
(CharArrayBuffer buffer) Subclasses must override this method to generate an instance ofHttpMessage
based on the initial input from the session buffer.Methods inherited from class org.apache.hc.core5.http.impl.io.AbstractMessageParser
createConnectionClosedException, getLineParser, parse, parseHeaders, parseHeaders
-
Field Details
-
responseFactory
-
-
Constructor Details
-
DefaultHttpResponseParser
public DefaultHttpResponseParser(LineParser lineParser, HttpResponseFactory<ClassicHttpResponse> responseFactory, Http1Config http1Config) Creates new instance of DefaultHttpResponseParser.- Parameters:
lineParser
- the line parser. Ifnull
LazyLineParser.INSTANCE
will be usedresponseFactory
- the response factory. Ifnull
DefaultClassicHttpResponseFactory.INSTANCE
will be used.http1Config
- the message http1Config. Ifnull
Http1Config.DEFAULT
will be used.- Since:
- 4.3
-
DefaultHttpResponseParser
- Since:
- 4.3
-
DefaultHttpResponseParser
public DefaultHttpResponseParser()- Since:
- 4.3
-
-
Method Details
-
createMessage
protected ClassicHttpResponse 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<ClassicHttpResponse>
- 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.
-