Class DefaultHttpResponseFactory
- java.lang.Object
-
- org.apache.hc.core5.http.impl.nio.DefaultHttpResponseFactory
-
- All Implemented Interfaces:
HttpResponseFactory<HttpResponse>
@Contract(threading=IMMUTABLE_CONDITIONAL) public class DefaultHttpResponseFactory extends java.lang.Object implements HttpResponseFactory<HttpResponse>
Default factory for creatingHttpResponseobjects.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultHttpResponseFactoryINSTANCEprivate ReasonPhraseCatalogreasonCatalog
-
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 HttpResponsenewHttpResponse(int status)Creates a new response with the given code.HttpResponsenewHttpResponse(int status, java.lang.String reasonPhrase)Creates response message with the given code and reason phrase.
-
-
-
Field Detail
-
INSTANCE
public static final DefaultHttpResponseFactory INSTANCE
-
reasonCatalog
private final ReasonPhraseCatalog reasonCatalog
-
-
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(int status, java.lang.String reasonPhrase)
Description copied from interface:HttpResponseFactoryCreates response message with the given code and reason phrase.- Specified by:
newHttpResponsein interfaceHttpResponseFactory<HttpResponse>- Parameters:
status- the status codereasonPhrase- the reason phrase- Returns:
- response message
-
newHttpResponse
public HttpResponse newHttpResponse(int status)
Description copied from interface:HttpResponseFactoryCreates a new response with the given code.- Specified by:
newHttpResponsein interfaceHttpResponseFactory<HttpResponse>- Parameters:
status- the status code- Returns:
- response message
-
-