to top
Android APIs
public class

DefaultHttpResponseFactory

extends Object
implements HttpResponseFactory
java.lang.Object
   ↳ org.apache.http.impl.DefaultHttpResponseFactory

Class Overview

Default implementation of a factory for creating response objects.

Summary

Fields
protected final ReasonPhraseCatalog reasonCatalog The catalog for looking up reason phrases.
Public Constructors
DefaultHttpResponseFactory(ReasonPhraseCatalog catalog)
Creates a new response factory with the given catalog.
DefaultHttpResponseFactory()
Creates a new response factory with the default catalog.
Public Methods
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.
Protected Methods
Locale determineLocale(HttpContext context)
Determines the locale of the response.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.HttpResponseFactory

Fields

protected final ReasonPhraseCatalog reasonCatalog

Since: API Level 1

The catalog for looking up reason phrases.

Public Constructors

public DefaultHttpResponseFactory (ReasonPhraseCatalog catalog)

Since: API Level 1

Creates a new response factory with the given catalog.

Parameters
catalog the catalog of reason phrases

public DefaultHttpResponseFactory ()

Since: API Level 1

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

Public Methods

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

Since: API Level 1

Creates a new response from status line elements.

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

public HttpResponse newHttpResponse (StatusLine statusline, HttpContext context)

Since: API Level 1

Creates a new response from a status line.

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

Protected Methods

protected Locale determineLocale (HttpContext context)

Since: API Level 1

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