@NotThreadSafe public class BasicHttpResponse extends AbstractHttpMessage implements HttpResponse
HttpResponse.DefaultHttpResponseFactoryheadergroup, params| Constructor and Description |
|---|
BasicHttpResponse(ProtocolVersion ver,
int code,
String reason)
Creates a response from elements of a status line.
|
BasicHttpResponse(StatusLine statusline)
Creates a response from a status line.
|
BasicHttpResponse(StatusLine statusline,
ReasonPhraseCatalog catalog,
Locale locale)
Deprecated.
(4.3) use
DefaultHttpRequestFactory |
| Modifier and Type | Method and Description |
|---|---|
HttpEntity |
getEntity()
Obtains the message entity of this response, if any.
|
Locale |
getLocale()
Deprecated.
(4.3) use
DefaultHttpRequestFactory |
ProtocolVersion |
getProtocolVersion()
Returns the protocol version this message is compatible with.
|
protected String |
getReason(int code)
Deprecated.
(4.3) use
DefaultHttpRequestFactory |
StatusLine |
getStatusLine()
Obtains the status line of this response.
|
void |
setEntity(HttpEntity entity)
Associates a response entity with this response.
|
void |
setLocale(Locale locale)
Deprecated.
(4.3) use
DefaultHttpRequestFactory |
void |
setReasonPhrase(String reason)
Updates the status line of this response with a new reason phrase.
|
void |
setStatusCode(int code)
Updates the status line of this response with a new status code.
|
void |
setStatusLine(ProtocolVersion ver,
int code)
Sets the status line of this response.
|
void |
setStatusLine(ProtocolVersion ver,
int code,
String reason)
Sets the status line of this response with a reason phrase.
|
void |
setStatusLine(StatusLine statusline)
Sets the status line of this response.
|
String |
toString() |
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParamsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams@Deprecated public BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, Locale locale)
DefaultHttpRequestFactorystatusline - the status linecatalog - the reason phrase catalog, or
null to disable automatic
reason phrase lookuplocale - the locale for looking up reason phrases, or
null for the system localepublic BasicHttpResponse(StatusLine statusline)
statusline - the status linepublic BasicHttpResponse(ProtocolVersion ver, int code, String reason)
ver - the protocol version of the responsecode - the status code of the responsereason - the reason phrase to the status code, or
nullpublic ProtocolVersion getProtocolVersion()
HttpMessagegetProtocolVersion in interface HttpMessagepublic StatusLine getStatusLine()
HttpResponsesetStatusLine methods,
or it can be initialized in a constructor.getStatusLine in interface HttpResponsenull if not yet setpublic HttpEntity getEntity()
HttpResponsesetEntity.getEntity in interface HttpResponsenull if there is none@Deprecated public Locale getLocale()
DefaultHttpRequestFactoryHttpResponsestatus code.
It can be changed using setLocale.getLocale in interface HttpResponsenullpublic void setStatusLine(StatusLine statusline)
HttpResponsesetStatusLine in interface HttpResponsestatusline - the status line of this responsepublic void setStatusLine(ProtocolVersion ver, int code)
HttpResponselocale.setStatusLine in interface HttpResponsever - the HTTP versioncode - the status codepublic void setStatusLine(ProtocolVersion ver, int code, String reason)
HttpResponsesetStatusLine in interface HttpResponsever - the HTTP versioncode - the status codereason - the reason phrase, or null to omitpublic void setStatusCode(int code)
HttpResponselocale. It can be set
explicitly using setReasonPhrase.setStatusCode in interface HttpResponsecode - the HTTP status code.HttpStatus,
HttpResponse.setStatusLine(StatusLine),
HttpResponse.setStatusLine(ProtocolVersion,int)public void setReasonPhrase(String reason)
HttpResponsesetReasonPhrase in interface HttpResponsereason - the new reason phrase as a single-line string, or
null to unset the reason phraseHttpResponse.setStatusLine(StatusLine),
HttpResponse.setStatusLine(ProtocolVersion,int)public void setEntity(HttpEntity entity)
HttpResponseHttpEntity.isStreaming() returns true),
it must be fully consumed in order to ensure release of resources.setEntity in interface HttpResponseentity - the entity to associate with this response, or
null to unsetHttpEntity.isStreaming(),
EntityUtils.updateEntity(HttpResponse, HttpEntity)@Deprecated public void setLocale(Locale locale)
DefaultHttpRequestFactoryHttpResponsesetLocale in interface HttpResponselocale - the new locale@Deprecated protected String getReason(int code)
DefaultHttpRequestFactorycode - the status code for which to look up the reasonnull if there is noneCopyright © 2005–2013 The Apache Software Foundation. All rights reserved.