Package org.apache.hc.core5.http.impl.io
Class DefaultClassicHttpResponseFactory
- java.lang.Object
-
- org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory
-
- All Implemented Interfaces:
HttpResponseFactory<ClassicHttpResponse>
@Contract(threading=IMMUTABLE_CONDITIONAL) public class DefaultClassicHttpResponseFactory extends java.lang.Object implements HttpResponseFactory<ClassicHttpResponse>
Default factory for creatingClassicHttpResponse
objects.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultClassicHttpResponseFactory
INSTANCE
private ReasonPhraseCatalog
reasonCatalog
-
Constructor Summary
Constructors Constructor Description DefaultClassicHttpResponseFactory()
Creates a new response factory with the default catalog.DefaultClassicHttpResponseFactory(ReasonPhraseCatalog catalog)
Creates a new response factory with the given catalog.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassicHttpResponse
newHttpResponse(int status)
Creates a new response with the given code.ClassicHttpResponse
newHttpResponse(int status, java.lang.String reasonPhrase)
Creates response message with the given code and reason phrase.
-
-
-
Field Detail
-
INSTANCE
public static final DefaultClassicHttpResponseFactory INSTANCE
-
reasonCatalog
private final ReasonPhraseCatalog reasonCatalog
-
-
Constructor Detail
-
DefaultClassicHttpResponseFactory
public DefaultClassicHttpResponseFactory(ReasonPhraseCatalog catalog)
Creates a new response factory with the given catalog.- Parameters:
catalog
- the catalog of reason phrases
-
DefaultClassicHttpResponseFactory
public DefaultClassicHttpResponseFactory()
Creates a new response factory with the default catalog. The default catalog isEnglishReasonPhraseCatalog
.
-
-
Method Detail
-
newHttpResponse
public ClassicHttpResponse newHttpResponse(int status, java.lang.String reasonPhrase)
Description copied from interface:HttpResponseFactory
Creates response message with the given code and reason phrase.- Specified by:
newHttpResponse
in interfaceHttpResponseFactory<ClassicHttpResponse>
- Parameters:
status
- the status codereasonPhrase
- the reason phrase- Returns:
- response message
-
newHttpResponse
public ClassicHttpResponse newHttpResponse(int status)
Description copied from interface:HttpResponseFactory
Creates a new response with the given code.- Specified by:
newHttpResponse
in interfaceHttpResponseFactory<ClassicHttpResponse>
- Parameters:
status
- the status code- Returns:
- response message
-
-