public class BasicHttpResponse extends HeaderGroup implements HttpResponse
HttpResponse.| 构造器和说明 |
|---|
BasicHttpResponse(int code)
Creates a new response.
|
BasicHttpResponse(int code,
ReasonPhraseCatalog catalog,
Locale locale)
Creates a new response.
|
BasicHttpResponse(int code,
String reasonPhrase)
Creates a new response.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHeader(String name,
Object value)
Adds a header to this message.
|
int |
getCode()
Obtains the code of this response message.
|
Locale |
getLocale()
Obtains the locale of this response.
|
protected String |
getReason(int code)
Looks up a reason phrase.
|
String |
getReasonPhrase()
Obtains the reason phrase of this response if available.
|
ProtocolVersion |
getVersion()
Returns protocol version or
null when not available. |
void |
setCode(int code)
Updates status code of this response message.
|
void |
setHeader(String name,
Object value)
Overwrites the first header with the same name.
|
void |
setLocale(Locale locale)
Changes the locale of this response.
|
void |
setReasonPhrase(String reason)
Updates the status line of this response with a new reason phrase.
|
void |
setVersion(ProtocolVersion version)
Sets protocol version.
|
String |
toString() |
addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeadersclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddHeader, removeHeader, removeHeaders, setHeader, setHeaderscontainsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIteratorpublic BasicHttpResponse(int code,
ReasonPhraseCatalog catalog,
Locale locale)
code - the status codecatalog - 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(int code,
String reasonPhrase)
code - the status code of the responsereasonPhrase - the reason phrase to the status code, or nullpublic BasicHttpResponse(int code)
code - the status code of the responsepublic void addHeader(String name, Object value)
HttpMessageaddHeader 在接口中 HttpMessagename - the name of the header.value - the value of the header, taken as the value's Object.toString().public void setHeader(String name, Object value)
HttpMessagesetHeader 在接口中 HttpMessagename - the name of the header.value - the value of the header, taken as the value's Object.toString().public void setVersion(ProtocolVersion version)
HttpMessageFor incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.
setVersion 在接口中 HttpMessagepublic ProtocolVersion getVersion()
HttpMessagenull when not available.
For incoming messages it represents protocol version this message was transmitted with. For outgoing messages it represents a hint what protocol version should be used to transmit the message.
getVersion 在接口中 HttpMessagepublic int getCode()
HttpResponsegetCode 在接口中 HttpResponsepublic Locale getLocale()
HttpResponsestatus code.
It can be changed using setLocale.getLocale 在接口中 HttpResponsenullpublic void setCode(int code)
HttpResponsesetCode 在接口中 HttpResponsecode - the HTTP status code.HttpStatuspublic String getReasonPhrase()
HttpResponsegetReasonPhrase 在接口中 HttpResponsepublic void setReasonPhrase(String reason)
HttpResponsesetReasonPhrase 在接口中 HttpResponsereason - the new reason phrase as a single-line string, or
null to unset the reason phrasepublic void setLocale(Locale locale)
HttpResponsesetLocale 在接口中 HttpResponselocale - the new localeprotected String getReason(int code)
code - the status code for which to look up the reasonnull if there is nonepublic String toString()
toString 在类中 HeaderGroupCopyright © 2023. All rights reserved.