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 Object
implements HttpResponseFactory<HttpResponse>
Default factory for creating
HttpResponse
objects.- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DefaultHttpResponseFactory
private final ReasonPhraseCatalog
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new response factory with the default catalog.Creates a new response factory with the given catalog. -
Method Summary
Modifier and TypeMethodDescriptionnewHttpResponse
(int status) Creates a new response with the given code.newHttpResponse
(int status, String reasonPhrase) Creates response message with the given code and reason phrase.
-
Field Details
-
INSTANCE
-
reasonCatalog
-
-
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:HttpResponseFactory
Creates response message with the given code and reason phrase.- Specified by:
newHttpResponse
in interfaceHttpResponseFactory<HttpResponse>
- Parameters:
status
- the status codereasonPhrase
- the reason phrase- Returns:
- response message
-
newHttpResponse
Description copied from interface:HttpResponseFactory
Creates a new response with the given code.- Specified by:
newHttpResponse
in interfaceHttpResponseFactory<HttpResponse>
- Parameters:
status
- the status code- Returns:
- response message
-