DefaultHttpResponseFactorypublic class DefaultHttpResponseFactory extends Object implements HttpResponseFactoryDefault implementation of a factory for creating response objects. |
Fields Summary |
---|
protected final ReasonPhraseCatalog | reasonCatalogThe catalog for looking up reason phrases. |
Constructors Summary |
---|
public DefaultHttpResponseFactory(ReasonPhraseCatalog catalog)Creates a new response factory with the given catalog.
if (catalog == null) {
throw new IllegalArgumentException
("Reason phrase catalog must not be null.");
}
this.reasonCatalog = catalog;
| public DefaultHttpResponseFactory()Creates a new response factory with the default catalog.
The default catalog is
{@link EnglishReasonPhraseCatalog EnglishReasonPhraseCatalog}.
this(EnglishReasonPhraseCatalog.INSTANCE);
|
Methods Summary |
---|
protected java.util.Locale | determineLocale(org.apache.http.protocol.HttpContext context)Determines the locale of the response.
The implementation in this class always returns the default locale.
return Locale.getDefault();
| public org.apache.http.HttpResponse | newHttpResponse(org.apache.http.ProtocolVersion ver, int status, org.apache.http.protocol.HttpContext context)
if (ver == null) {
throw new IllegalArgumentException("HTTP version may not be null");
}
final Locale loc = determineLocale(context);
final String reason = reasonCatalog.getReason(status, loc);
StatusLine statusline = new BasicStatusLine(ver, status, reason);
return new BasicHttpResponse(statusline, reasonCatalog, loc);
| public org.apache.http.HttpResponse | newHttpResponse(org.apache.http.StatusLine statusline, org.apache.http.protocol.HttpContext context)
if (statusline == null) {
throw new IllegalArgumentException("Status line may not be null");
}
final Locale loc = determineLocale(context);
return new BasicHttpResponse(statusline, reasonCatalog, loc);
|
|