Top Description Fields Constructors Methods
org.apache.http.impl

public Class DefaultHttpResponseFactory

extends Object
implements HttpResponseFactory
Class Inheritance
All Implemented Interfaces
org.apache.http.HttpResponseFactory
Annotations
@Contract
threading:IMMUTABLE_CONDITIONAL
Imports
java.util.Locale, org.apache.http.HttpResponse, .HttpResponseFactory, .ProtocolVersion, .ReasonPhraseCatalog, .StatusLine, org.apache.http.annotation.ThreadingBehavior, .Contract, org.apache.http.message.BasicHttpResponse, .BasicStatusLine, org.apache.http.protocol.HttpContext, org.apache.http.util.Args

Default factory for creating HttpResponse objects.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final DefaultHttpResponseFactory
protected final ReasonPhraseCatalog
reasonCatalog

The catalog for looking up reason phrases.

Constructor Summary

AccessConstructor and Description
public
DefaultHttpResponseFactory(final ReasonPhraseCatalog
the catalog of reason phrases
catalog
)

Creates a new response factory with the given catalog.

public
DefaultHttpResponseFactory()

Creates a new response factory with the default catalog.

Method Summary

Modifier and TypeMethod and Description
protected Locale

Returns:

the locale for the response, never null
determineLocale
(final HttpContext
the context from which to determine the locale, or null to use the default locale
context
)

Determines the locale of the response.

public HttpResponse
newHttpResponse(final ProtocolVersion
the protocol version
ver
,
final int
the status code
status
,
final HttpContext
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
context
)

Implements org.apache.http.HttpResponseFactory.newHttpResponse.

Creates a new response from status line elements.
public HttpResponse
newHttpResponse(final StatusLine
the status line
statusline
,
final HttpContext
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
context
)

Implements org.apache.http.HttpResponseFactory.newHttpResponse.

Creates a new response from a status line.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final DefaultHttpResponseFactory INSTANCE
reasonCatalogback to summary
protected final ReasonPhraseCatalog reasonCatalog

The catalog for looking up reason phrases.

Constructor Detail

DefaultHttpResponseFactoryback to summary
public DefaultHttpResponseFactory(final ReasonPhraseCatalog catalog)

Creates a new response factory with the given catalog.

Parameters
catalog:ReasonPhraseCatalog

the catalog of reason phrases

DefaultHttpResponseFactoryback to summary
public DefaultHttpResponseFactory()

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

Method Detail

determineLocaleback to summary
protected Locale determineLocale(final HttpContext context)

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

Parameters
context:HttpContext

the context from which to determine the locale, or null to use the default locale

Returns:Locale

the locale for the response, never null

newHttpResponseback to summary
public HttpResponse newHttpResponse(final ProtocolVersion ver, final int status, final HttpContext context)

Implements org.apache.http.HttpResponseFactory.newHttpResponse.

Doc from org.apache.http.HttpResponseFactory.newHttpResponse.

Creates a new response from status line elements.

Parameters
ver:ProtocolVersion

the protocol version

status:int

the status code

context:HttpContext

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:HttpResponse

the new response with an initialized status line

Annotations
@Override
newHttpResponseback to summary
public HttpResponse newHttpResponse(final StatusLine statusline, final HttpContext context)

Implements org.apache.http.HttpResponseFactory.newHttpResponse.

Doc from org.apache.http.HttpResponseFactory.newHttpResponse.

Creates a new response from a status line.

Parameters
statusline:StatusLine

the status line

context:HttpContext

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:HttpResponse

the new response with the argument status line

Annotations
@Override