Android

org.apache.http.message.BasicHttpResponse

java.lang.Object
org.apache.http.message.AbstractHttpMessage HttpMessage
org.apache.http.message.BasicHttpResponse HttpResponse

Basic implementation of an HTTP response that can be modified. This implementation makes sure that there always is a status line.

Summary

Fields inherited from class org.apache.http.message.AbstractHttpMessage

Public Constructors

            BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, Locale locale)
Creates a new response.
            BasicHttpResponse(StatusLine statusline)
Creates a response from a status line.
            BasicHttpResponse(ProtocolVersion ver, int code, String reason)
Creates a response from elements of a status line.

Public Methods

          HttpEntity  getEntity()
Obtains the message entity of this response, if any.
          Locale  getLocale()
Obtains the locale of this response.
          ProtocolVersion  getProtocolVersion()
Returns the protocol version this message is compatible with.
          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(StatusLine statusline)
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.

Protected Methods

          String  getReason(int code)
Looks up a reason phrase.
Methods inherited from class org.apache.http.message.AbstractHttpMessage
Methods inherited from class java.lang.Object
Methods inherited from interface org.apache.http.HttpMessage
Methods inherited from interface org.apache.http.HttpResponse

Details

Public Constructors

public BasicHttpResponse(StatusLine statusline, ReasonPhraseCatalog catalog, Locale locale)

Creates a new response. This is the constructor to which all others map.

Parameters

statusline the status line
catalog the reason phrase catalog, or null to disable automatic reason phrase lookup
locale the locale for looking up reason phrases, or null for the system locale

public BasicHttpResponse(StatusLine statusline)

Creates a response from a status line. The response will not have a reason phrase catalog and use the system default locale.

Parameters

statusline the status line

public BasicHttpResponse(ProtocolVersion ver, int code, String reason)

Creates a response from elements of a status line. The response will not have a reason phrase catalog and use the system default locale.

Parameters

ver the protocol version of the response
code the status code of the response
reason the reason phrase to the status code, or null

Public Methods

public HttpEntity getEntity()

Obtains the message entity of this response, if any. The entity is provided by calling setEntity.

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.

public ProtocolVersion getProtocolVersion()

Returns the protocol version this message is compatible with.

public StatusLine getStatusLine()

Obtains the status line of this response. The status line can be set using one of the setStatusLine methods, or it can be initialized in a constructor.

public void setEntity(HttpEntity entity)

Associates a response entity with this response.

public void setLocale(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.

public void setReasonPhrase(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.

public void setStatusCode(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 locale. It can be set explicitly using setReasonPhrase.

public void setStatusLine(ProtocolVersion ver, int code)

Sets the status line of this response. The reason phrase will be determined based on the current locale.

public void setStatusLine(StatusLine statusline)

Sets the status line of this response.

public void setStatusLine(ProtocolVersion ver, int code, String reason)

Sets the status line of this response with a reason phrase.

Protected Methods

protected String getReason(int code)

Looks up a reason phrase. This method evaluates the currently set catalog and locale. It also handles a missing catalog.

Parameters

code the status code for which to look up the reason

Returns

  • the reason phrase, or null if there is none
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56