Package 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 java.lang.Object implements HttpResponseFactory
Default factory for creatingHttpResponse
objects.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultHttpResponseFactory
INSTANCE
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
INSTANCE
public static final DefaultHttpResponseFactory INSTANCE
-
-
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 isEnglishReasonPhraseCatalog
.
-
-
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 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, ornull
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 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, ornull
to use the default locale- Returns:
- the new response with the argument status line
-
-