Top Description Methods
org.apache.hc.core5.http

public Interface HttpResponse

extends HttpMessage
Known Direct Subinterfaces
org.apache.hc.core5.http.ClassicHttpResponse
Known Direct Implementers
org.apache.hc.core5.http.message.BasicHttpResponse, org.apache.hc.core5.http.message.HttpResponseWrapper
Imports
java.util.Locale

After receiving and interpreting a request message, a server responds with an HTTP response message.
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the status code.
getCode
()

Obtains the code of this response message.

public Locale

Returns:

the locale of this response, never null
getLocale
()

Obtains the locale of this response.

public String

Returns:

the reason phrase.
getReasonPhrase
()

Obtains the reason phrase of this response if available.

public void
setCode(int
the HTTP status code.
code
)

Updates status code of this response message.

public void
setLocale(Locale
the new locale
loc
)

Changes the locale of this response.

public void
setReasonPhrase(String
the new reason phrase as a single-line string, or null to unset the reason phrase
reason
)

Updates the status line of this response with a new reason phrase.

Inherited from org.apache.hc.core5.http.HttpMessage:
addHeaderaddHeadergetVersionremoveHeaderremoveHeaderssetHeadersetHeadersetHeaderssetVersion

Method Detail

getCodeback to summary
public int getCode()

Obtains the code of this response message.

Returns:int

the status code.

getLocaleback to summary
public Locale getLocale()

Obtains the locale of this response. The locale is used to determine the reason phrase for the status code. It can be changed using setLocale.

Returns:Locale

the locale of this response, never null

getReasonPhraseback to summary
public String getReasonPhrase()

Obtains the reason phrase of this response if available.

Returns:String

the reason phrase.

setCodeback to summary
public void setCode(int code)

Updates status code of this response message.

Parameters
code:int

the HTTP status code.

See Also
HttpStatus
setLocaleback to summary
public void setLocale(Locale loc)

Changes the locale of this response.

Parameters
loc:Locale

the new locale

setReasonPhraseback to summary
public void setReasonPhrase(String reason)

Updates the status line of this response with a new reason phrase.

Parameters
reason:String

the new reason phrase as a single-line string, or null to unset the reason phrase