@NotThreadSafe public class BasicHttpResponse extends AbstractHttpMessage implements HttpResponse
HttpResponse.DefaultHttpResponseFactoryheadergroup, params| 构造器和说明 |
|---|
BasicHttpResponse(ProtocolVersion ver,
int code,
java.lang.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,
java.util.Locale locale)
Creates a new response.
|
| 限定符和类型 | 方法和说明 |
|---|---|
HttpEntity |
getEntity()
Obtains the message entity of this response, if any.
|
java.util.Locale |
getLocale()
Obtains the locale of this response.
|
ProtocolVersion |
getProtocolVersion()
Returns the protocol version this message is compatible with.
|
protected java.lang.String |
getReason(int code)
Looks up a reason phrase.
|
StatusLine |
getStatusLine()
Obtains the status line of this response.
|
void |
setEntity(HttpEntity entity)
Associates a response entity with this response.
|
void |
setLocale(java.util.Locale locale)
Changes the locale of this response.
|
void |
setReasonPhrase(java.lang.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,
java.lang.String reason)
Sets the status line of this response with a reason phrase.
|
void |
setStatusLine(StatusLine statusline)
Sets the status line of this response.
|
java.lang.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, setParamspublic BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, java.util.Locale locale)
statusline - 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, java.lang.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 在接口中 HttpMessagepublic StatusLine getStatusLine()
HttpResponsesetStatusLine methods,
or it can be initialized in a constructor.getStatusLine 在接口中 HttpResponsenull if not yet setpublic HttpEntity getEntity()
HttpResponsesetEntity.getEntity 在接口中 HttpResponsenull if there is nonepublic java.util.Locale getLocale()
HttpResponsestatus code.
It can be changed using setLocale.getLocale 在接口中 HttpResponsenullpublic void setStatusLine(StatusLine statusline)
HttpResponsesetStatusLine 在接口中 HttpResponsestatusline - the status line of this responsepublic void setStatusLine(ProtocolVersion ver, int code)
HttpResponselocale.setStatusLine 在接口中 HttpResponsever - the HTTP versioncode - the status codepublic void setStatusLine(ProtocolVersion ver, int code, java.lang.String reason)
HttpResponsesetStatusLine 在接口中 HttpResponsever - the HTTP versioncode - the status codereason - the reason phrase, or null to omitpublic void setStatusCode(int code)
HttpResponsesetStatusCode 在接口中 HttpResponsecode - the HTTP status code.HttpStatus,
HttpResponse.setStatusLine(StatusLine),
HttpResponse.setStatusLine(ProtocolVersion,int)public void setReasonPhrase(java.lang.String reason)
HttpResponsesetReasonPhrase 在接口中 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 在接口中 HttpResponseentity - the entity to associate with this response, or
null to unsetHttpEntity.isStreaming(),
EntityUtils.updateEntity(HttpResponse, HttpEntity)public void setLocale(java.util.Locale locale)
HttpResponsesetLocale 在接口中 HttpResponselocale - the new localeprotected java.lang.String getReason(int code)
code - the status code for which to look up the reasonnull if there is nonepublic java.lang.String toString()
toString 在类中 java.lang.Object