Top Description Fields Constructors Methods
org.apache.hc.core5.http.impl.io

public Class DefaultHttpResponseParser

extends AbstractMessageParser<ClassicHttpResponse>
Class Inheritance
Imports
java.io.IOException, org.apache.hc.core5.http.ClassicHttpResponse, .HttpException, .HttpResponseFactory, org.apache.hc.core5.http.config.Http1Config, org.apache.hc.core5.http.message.LineParser, .StatusLine, org.apache.hc.core5.util.CharArrayBuffer

HTTP response parser that obtain its input from an instance of org.apache.hc.core5.http.io.SessionInputBuffer.
Since
4.2

Field Summary

Modifier and TypeField and Description
private final HttpResponseFactory<ClassicHttpResponse>

Constructor Summary

AccessConstructor and Description
public
DefaultHttpResponseParser(final LineParser
the line parser. If null org.apache.hc.core5.http.message.LazyLineParser#INSTANCE will be used
lineParser
,
final HttpResponseFactory<ClassicHttpResponse>
the response factory. If null DefaultClassicHttpResponseFactory#INSTANCE will be used.
responseFactory
,
final Http1Config
the message http1Config. If null Http1Config#DEFAULT will be used.
http1Config
)

Creates new instance of DefaultHttpResponseParser.

public
public

Method Summary

Modifier and TypeMethod and Description
protected ClassicHttpResponse
createMessage(final CharArrayBuffer
the session input buffer.
buffer
)

Implements abstract org.apache.hc.core5.http.impl.io.AbstractMessageParser.createMessage.

Subclasses must override this method to generate an instance of HttpMessage based on the initial input from the session buffer.
Inherited from org.apache.hc.core5.http.impl.io.AbstractMessageParser:
createConnectionClosedExceptiongetLineParserparseparseHeadersparseHeaders

Field Detail

responseFactoryback to summary
private final HttpResponseFactory<ClassicHttpResponse> responseFactory

Constructor Detail

DefaultHttpResponseParserback to summary
public DefaultHttpResponseParser(final LineParser lineParser, final HttpResponseFactory<ClassicHttpResponse> responseFactory, final Http1Config http1Config)

Creates new instance of DefaultHttpResponseParser.

Parameters
lineParser:LineParser

the line parser. If null org.apache.hc.core5.http.message.LazyLineParser#INSTANCE will be used

responseFactory:HttpResponseFactory<ClassicHttpResponse>

the response factory. If null DefaultClassicHttpResponseFactory#INSTANCE will be used.

http1Config:Http1Config

the message http1Config. If null Http1Config#DEFAULT will be used.

Since
4.3
DefaultHttpResponseParserback to summary
public DefaultHttpResponseParser(final Http1Config http1Config)
Since
4.3
DefaultHttpResponseParserback to summary
public DefaultHttpResponseParser()
Since
4.3

Method Detail

createMessageback to summary
protected ClassicHttpResponse createMessage(final CharArrayBuffer buffer) throws IOException, HttpException

Implements abstract org.apache.hc.core5.http.impl.io.AbstractMessageParser.createMessage.

Doc from org.apache.hc.core5.http.impl.io.AbstractMessageParser.createMessage.

Subclasses must override this method to generate an instance of 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.

Parameters
buffer:CharArrayBuffer

the session input buffer.

Returns:ClassicHttpResponse

HTTP message based on the input from the session buffer.

Annotations
@Override
Exceptions
IOException:
in case of an I/O error.
HttpException:
in case of HTTP protocol violation.