org.apache.hc.core5.http.impl.io

## Class DefaultHttpResponseParser

- java.lang.Object
- - org.apache.hc.core5.http.impl.io.AbstractMessageParser<ClassicHttpResponse>
  - - org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser

- All Implemented Interfaces:
    HttpMessageParser<ClassicHttpResponse>

      public class DefaultHttpResponseParser
      extends AbstractMessageParser<ClassicHttpResponse>

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultHttpResponseParser()`
    `DefaultHttpResponseParser(Http1Config http1Config)`
    `DefaultHttpResponseParser(Http1Config http1Config, LineParser lineParser, HttpResponseFactory<ClassicHttpResponse> responseFactory)`
    `DefaultHttpResponseParser(LineParser lineParser, HttpResponseFactory<ClassicHttpResponse> responseFactory, Http1Config http1Config)` Deprecated. Use `DefaultHttpResponseParser(Http1Config, LineParser, HttpResponseFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ClassicHttpResponse` | `createMessage(CharArrayBuffer buffer)` 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.hc.core5.http.impl.io.AbstractMessageParser

      `createConnectionClosedException, 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(Http1Config http1Config,
                                           LineParser lineParser,
                                           HttpResponseFactory<ClassicHttpResponse> responseFactory)

      Since:
        5.3

    - #### DefaultHttpResponseParser

          @Deprecated
          public DefaultHttpResponseParser(LineParser lineParser,
                                                       HttpResponseFactory<ClassicHttpResponse> responseFactory,
                                                       Http1Config http1Config)

      Deprecated. Use `DefaultHttpResponseParser(Http1Config, LineParser, HttpResponseFactory)`

    - #### DefaultHttpResponseParser

          public DefaultHttpResponseParser(Http1Config http1Config)

      Since:
        4.3

    - #### DefaultHttpResponseParser

          public DefaultHttpResponseParser()

      Since:
        4.3

  - ### Method Detail

    - #### createMessage

          protected ClassicHttpResponse createMessage(CharArrayBuffer buffer)
                                               throws IOException,
                                                      HttpException

      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:
        `createMessage` in class `AbstractMessageParser<ClassicHttpResponse>`
      Parameters:
        `buffer` - 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.

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.