Android APIs
Added in API level 1
public interface

HttpMessage

org.apache.http.HttpMessage
Known Indirect Subclasses

Class Overview

A generic HTTP message. Holds what is common between requests and responses.

Summary

Public Methods
abstract void addHeader(Header header)
Adds a header to this message.
abstract void addHeader(String name, String value)
Adds a header to this message.
abstract boolean containsHeader(String name)
Checks if a certain header is present in this message.
abstract Header[] getAllHeaders()
Returns all the headers of this message.
abstract Header getFirstHeader(String name)
Returns the first header with a specified name of this message.
abstract Header[] getHeaders(String name)
Returns all the headers with a specified name of this message.
abstract Header getLastHeader(String name)
Returns the last header with a specified name of this message.
abstract HttpParams getParams()
Returns the parameters effective for this message as set by setParams(HttpParams).
abstract ProtocolVersion getProtocolVersion()
Returns the protocol version this message is compatible with.
abstract HeaderIterator headerIterator(String name)
Returns an iterator of the headers with a given name.
abstract HeaderIterator headerIterator()
Returns an iterator of all the headers.
abstract void removeHeader(Header header)
Removes a header from this message.
abstract void removeHeaders(String name)
Removes all headers with a certain name from this message.
abstract void setHeader(Header header)
Overwrites the first header with the same name.
abstract void setHeader(String name, String value)
Overwrites the first header with the same name.
abstract void setHeaders(Header[] headers)
Overwrites all the headers in the message.
abstract void setParams(HttpParams params)
Provides parameters to be used for the processing of this message.

Public Methods

public abstract void addHeader (Header header)

Added in API level 1

Adds a header to this message. The header will be appended to the end of the list.

Parameters
header the header to append.

public abstract void addHeader (String name, String value)

Added in API level 1

Adds a header to this message. The header will be appended to the end of the list.

Parameters
name the name of the header.
value the value of the header.

public abstract boolean containsHeader (String name)

Added in API level 1

Checks if a certain header is present in this message. Header values are ignored.

Parameters
name the header name to check for.
Returns
  • true if at least one header with this name is present.

public abstract Header[] getAllHeaders ()

Added in API level 1

Returns all the headers of this message. Headers are orderd in the sequence they will be sent over a connection.

Returns
  • all the headers of this message

public abstract Header getFirstHeader (String name)

Added in API level 1

Returns the first header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the first element of getHeaders(String) is returned. If there is no matching header in the message null is returned.

Parameters
name the name of the header to return.
Returns
  • the first header whose name property equals name or null if no such header could be found.

public abstract Header[] getHeaders (String name)

Added in API level 1

Returns all the headers with a specified name of this message. Header values are ignored. Headers are orderd in the sequence they will be sent over a connection.

Parameters
name the name of the headers to return.
Returns
  • the headers whose name property equals name.

public abstract Header getLastHeader (String name)

Added in API level 1

Returns the last header with a specified name of this message. Header values are ignored. If there is more than one matching header in the message the last element of getHeaders(String) is returned. If there is no matching header in the message null is returned.

Parameters
name the name of the header to return.
Returns
  • the last header whose name property equals name. or null if no such header could be found.

public abstract HttpParams getParams ()

Added in API level 1

Returns the parameters effective for this message as set by setParams(HttpParams).

public abstract ProtocolVersion getProtocolVersion ()

Added in API level 1

Returns the protocol version this message is compatible with.

public abstract HeaderIterator headerIterator (String name)

Added in API level 1

Returns an iterator of the headers with a given name.

Parameters
name the name of the headers over which to iterate, or null for all headers
Returns
  • Iterator that returns Header objects with the argument name in the sequence they are sent over a connection.

public abstract HeaderIterator headerIterator ()

Added in API level 1

Returns an iterator of all the headers.

Returns
  • Iterator that returns Header objects in the sequence they are sent over a connection.

public abstract void removeHeader (Header header)

Added in API level 1

Removes a header from this message.

Parameters
header the header to remove.

public abstract void removeHeaders (String name)

Added in API level 1

Removes all headers with a certain name from this message.

Parameters
name The name of the headers to remove.

public abstract void setHeader (Header header)

Added in API level 1

Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.

Parameters
header the header to set.

public abstract void setHeader (String name, String value)

Added in API level 1

Overwrites the first header with the same name. The new header will be appended to the end of the list, if no header with the given name can be found.

Parameters
name the name of the header.
value the value of the header.

public abstract void setHeaders (Header[] headers)

Added in API level 1

Overwrites all the headers in the message.

Parameters
headers the array of headers to set.

public abstract void setParams (HttpParams params)

Added in API level 1

Provides parameters to be used for the processing of this message.

Parameters
params the parameters