Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.impl
Class DefaultHttpResponseFactory

    java.lang.Object
      org.apache.http.impl.DefaultHttpResponseFactory

All Implemented Interfaces:
  HttpResponseFactory

    @Contract(threading=IMMUTABLE_CONDITIONAL)
    public class DefaultHttpResponseFactory

extends Object
implements HttpResponseFactory

Default factory for creating `HttpResponse` objects.

Since:
  4.0

Field Summary
`static DefaultHttpResponseFactory` | `INSTANCE`
`protected ReasonPhraseCatalog` | `reasonCatalog` The catalog for looking up reason phrases.

Constructor Summary
`DefaultHttpResponseFactory()` Creates a new response factory with the default catalog.
`DefaultHttpResponseFactory(ReasonPhraseCatalog catalog)` Creates a new response factory with the given catalog.

Method Summary
`protected Locale` | `determineLocale(HttpContext context)` Determines the locale of the response.
`HttpResponse` | `newHttpResponse(ProtocolVersion ver, int status, HttpContext context)` Creates a new response from status line elements.
`HttpResponse` | `newHttpResponse(StatusLine statusline, HttpContext context)` Creates a new response from a status line.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INSTANCE

    public static final DefaultHttpResponseFactory INSTANCE

### reasonCatalog

    protected final ReasonPhraseCatalog reasonCatalog

  The catalog for looking up reason phrases.

Constructor Detail

### DefaultHttpResponseFactory

    public DefaultHttpResponseFactory(ReasonPhraseCatalog catalog)

  Creates a new response factory with the given catalog.

  Parameters:
    `catalog` - the catalog of reason phrases

### DefaultHttpResponseFactory

    public DefaultHttpResponseFactory()

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

Method Detail

### newHttpResponse

    public HttpResponse newHttpResponse(ProtocolVersion ver,
                                        int status,
                                        HttpContext context)

  Description copied from interface: `HttpResponseFactory`
  Creates a new response from status line elements.

  Specified by:
    `newHttpResponse` in interface `HttpResponseFactory`
  Parameters:
    `ver` - the protocol version
    `status` - the status code
    `context` - the context from which to determine the locale for looking up a reason phrase to the status code, or `null` to use the default locale
  Returns:
    the new response with an initialized status line

### newHttpResponse

    public HttpResponse newHttpResponse(StatusLine statusline,
                                        HttpContext context)

  Description copied from interface: `HttpResponseFactory`
  Creates a new response from a status line.

  Specified by:
    `newHttpResponse` in interface `HttpResponseFactory`
  Parameters:
    `statusline` - the status line
    `context` - the context from which to determine the locale for looking up a reason phrase if the status code is updated, or `null` to use the default locale
  Returns:
    the new response with the argument status line

### determineLocale

    protected Locale determineLocale(HttpContext context)

  Determines the locale of the response. The implementation in this class always returns the default locale.

  Parameters:
    `context` - the context from which to determine the locale, or `null` to use the default locale
  Returns:
    the locale for the response, never `null`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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