Android APIs
public interface

HttpResponse

implements HttpMessage
org.apache.http.HttpResponse
Known Indirect Subclasses

Class Overview

An HTTP response.

Summary

Public Methods
abstract HttpEntity getEntity()
Obtains the message entity of this response, if any.
abstract Locale getLocale()
Obtains the locale of this response.
abstract StatusLine getStatusLine()
Obtains the status line of this response.
abstract void setEntity(HttpEntity entity)
Associates a response entity with this response.
abstract void setLocale(Locale loc)
Changes the locale of this response.
abstract void setReasonPhrase(String reason)
Updates the status line of this response with a new reason phrase.
abstract void setStatusCode(int code)
Updates the status line of this response with a new status code.
abstract void setStatusLine(StatusLine statusline)
Sets the status line of this response.
abstract void setStatusLine(ProtocolVersion ver, int code)
Sets the status line of this response.
abstract void setStatusLine(ProtocolVersion ver, int code, String reason)
Sets the status line of this response with a reason phrase.
[Expand]
Inherited Methods
From interface org.apache.http.HttpMessage

Public Methods

public abstract HttpEntity getEntity ()

Added in API level 1

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

Returns
  • the response entity, or null if there is none

public abstract Locale getLocale ()

Added in API level 1

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
  • the locale of this response, never null

public abstract StatusLine getStatusLine ()

Added in API level 1

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.

Returns
  • the status line, or null if not yet set

public abstract void setEntity (HttpEntity entity)

Added in API level 1

Associates a response entity with this response.

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

public abstract void setLocale (Locale loc)

Added in API level 1

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.

Parameters
loc the new locale

public abstract void setReasonPhrase (String reason)

Added in API level 1

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.

Parameters
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

public abstract void setStatusCode (int code)

Added in API level 1

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.

Parameters
code the HTTP status code.
Throws
IllegalStateException if the status line has not be set

public abstract void setStatusLine (StatusLine statusline)

Added in API level 1

Sets the status line of this response.

Parameters
statusline the status line of this response

public abstract void setStatusLine (ProtocolVersion ver, int code)

Added in API level 1

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

Parameters
ver the HTTP version
code the status code

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

Added in API level 1

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

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