org.apache.http.impl.io

## Class DefaultHttpRequestParser

- java.lang.Object
- - org.apache.http.impl.io.AbstractMessageParser<HttpRequest>
  - - org.apache.http.impl.io.DefaultHttpRequestParser

All Implemented Interfaces:
  HttpMessageParser<HttpRequest>

    @NotThreadSafe
    public class DefaultHttpRequestParser
    extends AbstractMessageParser<HttpRequest>

HTTP request parser that obtain its input from an instance of `SessionInputBuffer`.

Since:
  4.2

### Field Summary

### Fields inherited from class org.apache.http.impl.io.AbstractMessageParser

`lineParser`

### Constructor Summary

Constructors
Constructor and Description
`DefaultHttpRequestParser(SessionInputBuffer buffer)`
`DefaultHttpRequestParser(SessionInputBuffer buffer, LineParser lineParser, HttpRequestFactory requestFactory, HttpParams params)` Deprecated. (4.3) use `DefaultHttpRequestParser(SessionInputBuffer, LineParser, HttpRequestFactory, MessageConstraints)`
`DefaultHttpRequestParser(SessionInputBuffer buffer, LineParser lineParser, HttpRequestFactory requestFactory, MessageConstraints constraints)` Creates new instance of DefaultHttpRequestParser.
`DefaultHttpRequestParser(SessionInputBuffer buffer, MessageConstraints constraints)`

### Method Summary

Methods
`protected HttpRequest` `parseHead(SessionInputBuffer sessionBuffer)` Subclasses must override this method to generate an instance of `HttpMessage` based on the initial input from the session buffer.

### Methods inherited from class org.apache.http.impl.io.AbstractMessageParser

`parse, parseHeaders, parseHeaders`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultHttpRequestParser

    @Deprecated
    public DefaultHttpRequestParser(SessionInputBuffer buffer,
                                       LineParser lineParser,
                                       HttpRequestFactory requestFactory,
                                       HttpParams params)

Deprecated. (4.3) use `DefaultHttpRequestParser(SessionInputBuffer, LineParser, HttpRequestFactory, MessageConstraints)`
Creates an instance of this class.

Parameters:
  `buffer` - the session input buffer.
  `lineParser` - the line parser.
  `requestFactory` - the factory to use to create `HttpRequest`s.
  `params` - HTTP parameters.

#### DefaultHttpRequestParser

    public DefaultHttpRequestParser(SessionInputBuffer buffer,
                            LineParser lineParser,
                            HttpRequestFactory requestFactory,
                            MessageConstraints constraints)

Creates new instance of DefaultHttpRequestParser.

Parameters:
  `buffer` - the session input buffer.
  `lineParser` - the line parser. If `null` `BasicLineParser.INSTANCE` will be used.
  `requestFactory` - the response factory. If `null` `DefaultHttpRequestFactory.INSTANCE` will be used.
  `constraints` - the message constraints. If `null` `MessageConstraints.DEFAULT` will be used.
Since:
  4.3

#### DefaultHttpRequestParser

    public DefaultHttpRequestParser(SessionInputBuffer buffer,
                            MessageConstraints constraints)

Since:
  4.3

#### DefaultHttpRequestParser

    public DefaultHttpRequestParser(SessionInputBuffer buffer)

Since:
  4.3

### Method Detail

#### parseHead

    protected HttpRequest parseHead(SessionInputBuffer sessionBuffer)
                             throws IOException,
                                    HttpException,
                                    ParseException

Description copied from class: `AbstractMessageParser`
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`.

Specified by:
  `parseHead` in class `AbstractMessageParser<HttpRequest>`
Parameters:
  `sessionBuffer` - 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.
  `ParseException` - in case of a parse error.