Build 1.0_r1

org.apache.http.message
Class AbstractHttpMessage

java.lang.Object
  extended by org.apache.http.message.AbstractHttpMessage
All Implemented Interfaces:
HttpMessage
Direct Known Subclasses:
BasicHttpRequest, BasicHttpResponse, HttpRequestBase, RequestWrapper

public abstract class AbstractHttpMessage
extends Object
implements HttpMessage

Basic implementation of an HTTP message that can be modified.


Field Summary
protected  HeaderGroup headergroup
           
protected  HttpParams params
           
 
Constructor Summary
protected AbstractHttpMessage()
           
protected AbstractHttpMessage(HttpParams params)
           
 
Method Summary
 void addHeader(Header header)
          Adds a header to this message.
 void addHeader(String name, String value)
          Adds a header to this message.
 boolean containsHeader(String name)
          Checks if a certain header is present in this message.
 Header[] getAllHeaders()
          Returns all the headers of this message.
 Header getFirstHeader(String name)
          Returns the first header with a specified name of this message.
 Header[] getHeaders(String name)
          Returns all the headers with a specified name of this message.
 Header getLastHeader(String name)
          Returns the last header with a specified name of this message.
 HttpParams getParams()
          Returns the parameters effective for this message as set by setParams(HttpParams).
 HeaderIterator headerIterator()
          Returns an iterator of all the headers.
 HeaderIterator headerIterator(String name)
          Returns an iterator of the headers with a given name.
 void removeHeader(Header header)
          Removes a header from this message.
 void removeHeaders(String name)
          Removes all headers with a certain name from this message.
 void setHeader(Header header)
          Overwrites the first header with the same name.
 void setHeader(String name, String value)
          Overwrites the first header with the same name.
 void setHeaders(Header[] headers)
          Overwrites all the headers in the message.
 void setParams(HttpParams params)
          Provides parameters to be used for the processing of this message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpMessage
getProtocolVersion
 

Field Detail

headergroup

protected HeaderGroup headergroup

params

protected HttpParams params
Constructor Detail

AbstractHttpMessage

protected AbstractHttpMessage(HttpParams params)

AbstractHttpMessage

protected AbstractHttpMessage()
Method Detail

containsHeader

public boolean containsHeader(String name)
Checks if a certain header is present in this message. Header values are ignored.

Specified by:
containsHeader in interface HttpMessage

getHeaders

public Header[] getHeaders(String name)
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.

Specified by:
getHeaders in interface HttpMessage

getFirstHeader

public Header getFirstHeader(String name)
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.

Specified by:
getFirstHeader in interface HttpMessage

getLastHeader

public Header getLastHeader(String name)
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.

Specified by:
getLastHeader in interface HttpMessage

getAllHeaders

public Header[] getAllHeaders()
Returns all the headers of this message. Headers are orderd in the sequence they will be sent over a connection.

Specified by:
getAllHeaders in interface HttpMessage
Returns:
all the headers of this message

addHeader

public void addHeader(Header header)
Adds a header to this message. The header will be appended to the end of the list.

Specified by:
addHeader in interface HttpMessage
Parameters:
header - the header to append.

addHeader

public void addHeader(String name,
                      String value)
Adds a header to this message. The header will be appended to the end of the list.

Specified by:
addHeader in interface HttpMessage

setHeader

public void setHeader(Header header)
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.

Specified by:
setHeader in interface HttpMessage
Parameters:
header - the header to set.

setHeader

public void setHeader(String name,
                      String value)
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.

Specified by:
setHeader in interface HttpMessage

setHeaders

public void setHeaders(Header[] headers)
Overwrites all the headers in the message.

Specified by:
setHeaders in interface HttpMessage

removeHeader

public void removeHeader(Header header)
Removes a header from this message.

Specified by:
removeHeader in interface HttpMessage
Parameters:
header - the header to remove.

removeHeaders

public void removeHeaders(String name)
Removes all headers with a certain name from this message.

Specified by:
removeHeaders in interface HttpMessage

headerIterator

public HeaderIterator headerIterator()
Returns an iterator of all the headers.

Specified by:
headerIterator in interface HttpMessage
Returns:
Iterator that returns Header objects in the sequence they are sent over a connection.

headerIterator

public HeaderIterator headerIterator(String name)
Returns an iterator of the headers with a given name.

Specified by:
headerIterator in interface HttpMessage

getParams

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

Specified by:
getParams in interface HttpMessage

setParams

public void setParams(HttpParams params)
Provides parameters to be used for the processing of this message.

Specified by:
setParams in interface HttpMessage

Build 1.0_r1

Please submit a feedback, bug or feature