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

public Class DefaultHttpRequestParser

extends AbstractMessageParser<ClassicHttpRequest>
Class Inheritance
Imports
java.io.IOException, .InputStream, org.apache.hc.core5.http.ClassicHttpRequest, .HttpException, .HttpRequestFactory, .MessageConstraintException, .RequestHeaderFieldsTooLargeException, org.apache.hc.core5.http.config.Http1Config, org.apache.hc.core5.http.io.SessionInputBuffer, org.apache.hc.core5.http.message.LineParser, .RequestLine, org.apache.hc.core5.util.CharArrayBuffer

HTTP request 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 HttpRequestFactory<ClassicHttpRequest>

Constructor Summary

AccessConstructor and Description
public
DefaultHttpRequestParser(final LineParser
the line parser. If null org.apache.hc.core5.http.message.LazyLineParser#INSTANCE will be used.
lineParser
,
final HttpRequestFactory<ClassicHttpRequest>
the response factory. If null DefaultClassicHttpRequestFactory#INSTANCE will be used.
requestFactory
,
final Http1Config
the message http1Config. If null Http1Config#DEFAULT will be used.
http1Config
)

Creates new instance of DefaultHttpRequestParser.

public
public

Method Summary

Modifier and TypeMethod and Description
protected ClassicHttpRequest
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.
public ClassicHttpRequest
parse(final SessionInputBuffer
Session input buffer
buffer
,
final InputStream
Input stream
inputStream
)

Overrides org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse.

Implements org.apache.hc.core5.http.io.HttpMessageParser.parse.

Generates an instance of MessageHeaders from the given input stream..
Inherited from org.apache.hc.core5.http.impl.io.AbstractMessageParser:
createConnectionClosedExceptiongetLineParserparseHeadersparseHeaders

Field Detail

requestFactoryback to summary
private final HttpRequestFactory<ClassicHttpRequest> requestFactory

Constructor Detail

DefaultHttpRequestParserback to summary
public DefaultHttpRequestParser(final LineParser lineParser, final HttpRequestFactory<ClassicHttpRequest> requestFactory, final Http1Config http1Config)

Creates new instance of DefaultHttpRequestParser.

Parameters
lineParser:LineParser

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

requestFactory:HttpRequestFactory<ClassicHttpRequest>

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

http1Config:Http1Config

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

Since
4.3
DefaultHttpRequestParserback to summary
public DefaultHttpRequestParser(final Http1Config http1Config)
Since
4.3
DefaultHttpRequestParserback to summary
public DefaultHttpRequestParser()
Since
4.3

Method Detail

createMessageback to summary
protected ClassicHttpRequest 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:ClassicHttpRequest

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.
parseback to summary
public ClassicHttpRequest parse(final SessionInputBuffer buffer, final InputStream inputStream) throws IOException, HttpException

Overrides org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse.

Implements org.apache.hc.core5.http.io.HttpMessageParser.parse.

Doc from org.apache.hc.core5.http.io.HttpMessageParser.parse.

Generates an instance of MessageHeaders from the given input stream..

Parameters
buffer:SessionInputBuffer

Session input buffer

inputStream:InputStream

Input stream

Returns:ClassicHttpRequest

HTTP message head or null if the input stream has been closed by the opposite endpoint.

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