public interface HttpResponse extends HttpMessage
Response = Status-Line *(( general-header | response-header | entity-header ) CRLF) CRLF [ message-body ]
Modifier and Type | Method and Description |
---|---|
HttpEntity |
getEntity()
Obtains the message entity of this response, if any.
|
Locale |
getLocale()
Obtains the locale of this response.
|
StatusLine |
getStatusLine()
Obtains the status line of this response.
|
void |
setEntity(HttpEntity entity)
Associates a response entity with this response.
|
void |
setLocale(Locale loc)
Changes the locale of this response.
|
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.
|
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, getProtocolVersion, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
StatusLine getStatusLine()
setStatusLine
methods,
or it can be initialized in a constructor.null
if not yet setvoid setStatusLine(StatusLine statusline)
statusline
- the status line of this responsevoid setStatusLine(ProtocolVersion ver, int code)
locale
.ver
- the HTTP versioncode
- the status codevoid setStatusLine(ProtocolVersion ver, int code, String reason)
ver
- the HTTP versioncode
- the status codereason
- the reason phrase, or null
to omitvoid setStatusCode(int code) throws IllegalStateException
locale
. It can be set
explicitly using setReasonPhrase
.code
- the HTTP status code.IllegalStateException
- if the status line has not be setHttpStatus
,
setStatusLine(StatusLine)
,
setStatusLine(ProtocolVersion,int)
void setReasonPhrase(String reason) throws IllegalStateException
reason
- the new reason phrase as a single-line string, or
null
to unset the reason phraseIllegalStateException
- if the status line has not be setsetStatusLine(StatusLine)
,
setStatusLine(ProtocolVersion,int)
HttpEntity getEntity()
setEntity
.null
if there is nonevoid setEntity(HttpEntity entity)
HttpEntity.isStreaming()
returns true
),
it must be fully consumed in order to ensure release of resources.entity
- the entity to associate with this response, or
null
to unsetHttpEntity.isStreaming()
Locale getLocale()
status code
.
It can be changed using setLocale
.null
void setLocale(Locale loc)
loc
- the new localegetLocale
,
setStatusCode
Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.