## org.apache.http.impl.io
Class DefaultHttpResponseParser

    java.lang.Object
      org.apache.http.impl.io.AbstractMessageParser<HttpResponse>
          org.apache.http.impl.io.DefaultHttpResponseParser

All Implemented Interfaces:
  HttpMessageParser<HttpResponse>

    @NotThreadSafe
    public class DefaultHttpResponseParser

extends AbstractMessageParser<HttpResponse>

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

The following parameters can be used to customize the behavior of this class:

- `CoreConnectionPNames.MAX_HEADER_COUNT`
- `CoreConnectionPNames.MAX_LINE_LENGTH`

Since:
  4.2

Field Summary

Fields inherited from class org.apache.http.impl.io.AbstractMessageParser
`lineParser`

Constructor Summary
`DefaultHttpResponseParser(SessionInputBuffer buffer, LineParser parser, HttpResponseFactory responseFactory, HttpParams params)` Creates an instance of this class.

Method Summary
`protected HttpResponse` `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

### DefaultHttpResponseParser

    public DefaultHttpResponseParser(SessionInputBuffer buffer,
                                     LineParser parser,
                                     HttpResponseFactory responseFactory,
                                     HttpParams params)

  Creates an instance of this class.

  Parameters:
    `buffer` - the session input buffer.
    `parser` - the line parser.
    `responseFactory` - the factory to use to create `HttpResponse`s.
    `params` - HTTP parameters.

Method Detail

### parseHead

    protected HttpResponse 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<HttpResponse>`
  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.

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.