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

public Class LenientHttpResponseParser

extends DefaultHttpResponseParser
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.impl.io.DefaultHttpResponseParser, org.apache.hc.core5.http.message.LineParser, org.apache.hc.core5.util.CharArrayBuffer, org.slf4j.Logger, .LoggerFactory

Lenient HTTP response parser implementation that can skip malformed data until a valid HTTP response message head is encountered.
Since
4.2

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public
LenientHttpResponseParser(final LineParser
the line parser. If null org.apache.hc.core5.http.message.BasicLineParser#INSTANCE will be used.
lineParser
,
final HttpResponseFactory<ClassicHttpResponse> responseFactory, final Http1Config
HTTP/1.1 parameters. If null. Http1Config#DEFAULT will be used.
h1Config
)

Creates new instance of DefaultHttpResponseParser.

public
LenientHttpResponseParser(final Http1Config
HTTP/1.1 parameters. If null. Http1Config#DEFAULT will be used.
h1Config
)

Creates new instance of DefaultHttpResponseParser.

Method Summary

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

Overrides org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser.createMessage.

Subclasses must override this method to generate an instance of HttpMessage based on the initial input from the session buffer.

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

LenientHttpResponseParserback to summary
public LenientHttpResponseParser(final LineParser lineParser, final HttpResponseFactory<ClassicHttpResponse> responseFactory, final Http1Config h1Config)

Creates new instance of DefaultHttpResponseParser.

Parameters
lineParser:LineParser

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

responseFactory:HttpResponseFactory<ClassicHttpResponse>

HTTP response factory. If null org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory#INSTANCE will be used.

h1Config:Http1Config

HTTP/1.1 parameters. If null. Http1Config#DEFAULT will be used.

Since
4.3
LenientHttpResponseParserback to summary
public LenientHttpResponseParser(final Http1Config h1Config)

Creates new instance of DefaultHttpResponseParser.

Parameters
h1Config:Http1Config

HTTP/1.1 parameters. If null. Http1Config#DEFAULT will be used.

Since
4.3

Method Detail

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

Overrides org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser.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.