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

## Class DefaultClassicHttpResponseFactory

- java.lang.Object
- - org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory

- All Implemented Interfaces:
    HttpResponseFactory<ClassicHttpResponse>

      @Contract(threading=IMMUTABLE_CONDITIONAL)
      public class DefaultClassicHttpResponseFactory
      extends Object
      implements HttpResponseFactory<ClassicHttpResponse>

  Default factory for creating `ClassicHttpResponse` objects.
  Since:
    4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DefaultClassicHttpResponseFactory` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultClassicHttpResponseFactory()` Creates a new response factory with the default catalog.
    `DefaultClassicHttpResponseFactory(ReasonPhraseCatalog catalog)` Creates a new response factory with the given catalog.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClassicHttpResponse` | `newHttpResponse(int status)` Creates a new response with the given code.
    `ClassicHttpResponse` | `newHttpResponse(int status, String reasonPhrase)` Creates response message with the given code and reason phrase.

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final DefaultClassicHttpResponseFactory INSTANCE

  - ### Constructor Detail

    - #### DefaultClassicHttpResponseFactory

          public DefaultClassicHttpResponseFactory(ReasonPhraseCatalog catalog)

      Creates a new response factory with the given catalog.
      Parameters:
        `catalog` - the catalog of reason phrases

    - #### DefaultClassicHttpResponseFactory

          public DefaultClassicHttpResponseFactory()

      Creates a new response factory with the default catalog. The default catalog is `EnglishReasonPhraseCatalog`.

  - ### Method Detail

    - #### newHttpResponse

          public ClassicHttpResponse newHttpResponse(int status,
                                                     String reasonPhrase)

      Description copied from interface: `HttpResponseFactory`
      Creates response message with the given code and reason phrase.
      Specified by:
        `newHttpResponse` in interface `HttpResponseFactory<ClassicHttpResponse>`
      Parameters:
        `status` - the status code
        `reasonPhrase` - the reason phrase
      Returns:
        response message

    - #### newHttpResponse

          public ClassicHttpResponse newHttpResponse(int status)

      Description copied from interface: `HttpResponseFactory`
      Creates a new response with the given code.
      Specified by:
        `newHttpResponse` in interface `HttpResponseFactory<ClassicHttpResponse>`
      Parameters:
        `status` - the status code
      Returns:
        response message

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