FileDocCategorySizeDatePackage
HttpResponse.javaAPI DocAndroid 1.5 API5392Wed May 06 22:41:10 BST 2009org.apache.http

HttpResponse

public interface HttpResponse implements HttpMessage
An HTTP response.
author
Oleg Kalnichevski
version
$Revision: 652956 $
since
4.0

Fields Summary
Constructors Summary
Methods Summary
public org.apache.http.HttpEntitygetEntity()
Obtains the message entity of this response, if any. The entity is provided by calling {@link #setEntity setEntity}.

return
the response entity, or null if there is none

public java.util.LocalegetLocale()
Obtains the locale of this response. The locale is used to determine the reason phrase for the {@link #setStatusCode status code}. It can be changed using {@link #setLocale setLocale}.

return
the locale of this response, never null

public org.apache.http.StatusLinegetStatusLine()
Obtains the status line of this response. The status line can be set using one of the {@link #setStatusLine setStatusLine} methods, or it can be initialized in a constructor.

return
the status line, or null if not yet set

public voidsetEntity(org.apache.http.HttpEntity entity)
Associates a response entity with this response.

param
entity the entity to associate with this response, or null to unset

public voidsetLocale(java.util.Locale loc)
Changes the locale of this response. If there is a status line, it's reason phrase will be updated according to the status code and new locale.

param
loc the new locale
see
#getLocale getLocale
see
#setStatusCode setStatusCode

public voidsetReasonPhrase(java.lang.String reason)
Updates the status line of this response with a new reason phrase. The status line can only be updated if it is available. It must have been set either explicitly or in a constructor.

param
reason the new reason phrase as a single-line string, or null to unset the reason phrase
throws
IllegalStateException if the status line has not be set
see
#setStatusLine(StatusLine)
see
#setStatusLine(ProtocolVersion,int)

public voidsetStatusCode(int code)
Updates the status line of this response with a new status code. The status line can only be updated if it is available. It must have been set either explicitly or in a constructor.
The reason phrase will be updated according to the new status code, based on the current {@link #getLocale locale}. It can be set explicitly using {@link #setReasonPhrase setReasonPhrase}.

param
code the HTTP status code.
throws
IllegalStateException if the status line has not be set
see
HttpStatus
see
#setStatusLine(StatusLine)
see
#setStatusLine(ProtocolVersion,int)

public voidsetStatusLine(org.apache.http.StatusLine statusline)
Sets the status line of this response.

param
statusline the status line of this response

public voidsetStatusLine(org.apache.http.ProtocolVersion ver, int code)
Sets the status line of this response. The reason phrase will be determined based on the current {@link #getLocale locale}.

param
ver the HTTP version
param
code the status code

public voidsetStatusLine(org.apache.http.ProtocolVersion ver, int code, java.lang.String reason)
Sets the status line of this response with a reason phrase.

param
ver the HTTP version
param
code the status code
param
reason the reason phrase, or null to omit