Package org.apache.http.impl
Class DefaultHttpResponseFactory
java.lang.Object
org.apache.http.impl.DefaultHttpResponseFactory
- All Implemented Interfaces:
HttpResponseFactory
public class DefaultHttpResponseFactory extends Object implements HttpResponseFactory
Default implementation of a factory for creating response objects.
- Since:
- 4.0
- Version:
- $Revision: 618367 $
- Author:
- Oleg Kalnichevski
-
Field Summary
Fields Modifier and Type Field Description protected ReasonPhraseCatalogreasonCatalogThe catalog for looking up reason phrases. -
Constructor Summary
Constructors Constructor Description DefaultHttpResponseFactory()Creates a new response factory with the default catalog.DefaultHttpResponseFactory(ReasonPhraseCatalog catalog)Creates a new response factory with the given catalog. -
Method Summary
Modifier and Type Method Description protected LocaledetermineLocale(HttpContext context)Determines the locale of the response.HttpResponsenewHttpResponse(ProtocolVersion ver, int status, HttpContext context)Creates a new response from status line elements.HttpResponsenewHttpResponse(StatusLine statusline, HttpContext context)Creates a new response from a status line.
-
Field Details
-
reasonCatalog
The catalog for looking up reason phrases.
-
-
Constructor Details
-
DefaultHttpResponseFactory
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 isEnglishReasonPhraseCatalog.
-
-
Method Details
-
newHttpResponse
Description copied from interface:HttpResponseFactoryCreates a new response from status line elements.- Specified by:
newHttpResponsein interfaceHttpResponseFactory- Parameters:
ver- the protocol versionstatus- the status codecontext- the context from which to determine the locale for looking up a reason phrase to the status code, ornullto use the default locale- Returns:
- the new response with an initialized status line
-
newHttpResponse
Description copied from interface:HttpResponseFactoryCreates a new response from a status line.- Specified by:
newHttpResponsein interfaceHttpResponseFactory- Parameters:
statusline- the status linecontext- the context from which to determine the locale for looking up a reason phrase if the status code is updated, ornullto use the default locale- Returns:
- the new response with the argument status line
-
determineLocale
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, ornullto use the default locale- Returns:
- the locale for the response, never
null
-