Package org.apache.hc.core5.http
Interface HttpResponse
- All Superinterfaces:
HttpMessage
,MessageHeaders
- All Known Subinterfaces:
ClassicHttpResponse
- All Known Implementing Classes:
BasicClassicHttpResponse
,BasicHttpResponse
,HttpResponseWrapper
After receiving and interpreting a request message, a server responds
with an HTTP response message.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionint
getCode()
Obtains the code of this response message.Obtains the locale of this response.Obtains the reason phrase of this response if available.void
setCode
(int code) Updates status code of this response message.void
Changes the locale of this response.void
setReasonPhrase
(String reason) Updates the status line of this response with a new reason phrase.Methods inherited from interface org.apache.hc.core5.http.HttpMessage
addHeader, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion
Methods inherited from interface org.apache.hc.core5.http.MessageHeaders
containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
-
Method Details
-
getCode
int getCode()Obtains the code of this response message.- Returns:
- the status code.
-
setCode
void setCode(int code) Updates status code of this response message.- Parameters:
code
- the HTTP status code.- See Also:
-
getReasonPhrase
String getReasonPhrase()Obtains the reason phrase of this response if available.- Returns:
- the reason phrase.
-
setReasonPhrase
Updates the status line of this response with a new reason phrase.- Parameters:
reason
- the new reason phrase as a single-line string, ornull
to unset the reason phrase
-
getLocale
Locale getLocale()Obtains the locale of this response. The locale is used to determine the reason phrase for thestatus code
. It can be changed usingsetLocale
.- Returns:
- the locale of this response, never
null
-
setLocale
Changes the locale of this response.- Parameters:
loc
- the new locale
-