Package org.apache.http.message
Class AbstractHttpMessage
java.lang.Object
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.
- Since:
- 4.0
- Version:
- $Revision: 620287 $
- Author:
- Oleg Kalnichevski
-
Field Summary
Fields Modifier and Type Field Description protected HeaderGroupheadergroupprotected HttpParamsparams -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractHttpMessage()protectedAbstractHttpMessage(HttpParams params) -
Method Summary
Modifier and Type Method Description voidaddHeader(String name, String value)Adds a header to this message.voidaddHeader(Header header)Adds a header to this message.booleancontainsHeader(String name)Checks if a certain header is present in this message.Header[]getAllHeaders()Returns all the headers of this message.HeadergetFirstHeader(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.HeadergetLastHeader(String name)Returns the last header with a specified name of this message.HttpParamsgetParams()Returns the parameters effective for this message as set byHttpMessage.setParams(HttpParams).HeaderIteratorheaderIterator()Returns an iterator of all the headers.HeaderIteratorheaderIterator(String name)Returns an iterator of the headers with a given name.voidremoveHeader(Header header)Removes a header from this message.voidremoveHeaders(String name)Removes all headers with a certain name from this message.voidsetHeader(String name, String value)Overwrites the first header with the same name.voidsetHeader(Header header)Overwrites the first header with the same name.voidsetHeaders(Header[] headers)Overwrites all the headers in the message.voidsetParams(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, waitMethods inherited from interface org.apache.http.HttpMessage
getProtocolVersion
-
Field Details
-
headergroup
-
params
-
-
Constructor Details
-
AbstractHttpMessage
-
AbstractHttpMessage
protected AbstractHttpMessage()
-
-
Method Details
-
containsHeader
Description copied from interface:HttpMessageChecks if a certain header is present in this message. Header values are ignored.- Specified by:
containsHeaderin interfaceHttpMessage- Parameters:
name- the header name to check for.- Returns:
- true if at least one header with this name is present.
-
getHeaders
Description copied from interface:HttpMessageReturns 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:
getHeadersin interfaceHttpMessage- Parameters:
name- the name of the headers to return.- Returns:
- the headers whose name property equals
name.
-
getFirstHeader
Description copied from interface:HttpMessageReturns 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 ofHttpMessage.getHeaders(String)is returned. If there is no matching header in the messagenullis returned.- Specified by:
getFirstHeaderin interfaceHttpMessage- Parameters:
name- the name of the header to return.- Returns:
- the first header whose name property equals
nameornullif no such header could be found.
-
getLastHeader
Description copied from interface:HttpMessageReturns 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 ofHttpMessage.getHeaders(String)is returned. If there is no matching header in the messagenullis returned.- Specified by:
getLastHeaderin interfaceHttpMessage- Parameters:
name- the name of the header to return.- Returns:
- the last header whose name property equals
name. ornullif no such header could be found.
-
getAllHeaders
Description copied from interface:HttpMessageReturns all the headers of this message. Headers are orderd in the sequence they will be sent over a connection.- Specified by:
getAllHeadersin interfaceHttpMessage- Returns:
- all the headers of this message
-
addHeader
Description copied from interface:HttpMessageAdds a header to this message. The header will be appended to the end of the list.- Specified by:
addHeaderin interfaceHttpMessage- Parameters:
header- the header to append.
-
addHeader
Description copied from interface:HttpMessageAdds a header to this message. The header will be appended to the end of the list.- Specified by:
addHeaderin interfaceHttpMessage- Parameters:
name- the name of the header.value- the value of the header.
-
setHeader
Description copied from interface:HttpMessageOverwrites 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:
setHeaderin interfaceHttpMessage- Parameters:
header- the header to set.
-
setHeader
Description copied from interface:HttpMessageOverwrites 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:
setHeaderin interfaceHttpMessage- Parameters:
name- the name of the header.value- the value of the header.
-
setHeaders
Description copied from interface:HttpMessageOverwrites all the headers in the message.- Specified by:
setHeadersin interfaceHttpMessage- Parameters:
headers- the array of headers to set.
-
removeHeader
Description copied from interface:HttpMessageRemoves a header from this message.- Specified by:
removeHeaderin interfaceHttpMessage- Parameters:
header- the header to remove.
-
removeHeaders
Description copied from interface:HttpMessageRemoves all headers with a certain name from this message.- Specified by:
removeHeadersin interfaceHttpMessage- Parameters:
name- The name of the headers to remove.
-
headerIterator
Description copied from interface:HttpMessageReturns an iterator of all the headers.- Specified by:
headerIteratorin interfaceHttpMessage- Returns:
- Iterator that returns Header objects in the sequence they are sent over a connection.
-
headerIterator
Description copied from interface:HttpMessageReturns an iterator of the headers with a given name.- Specified by:
headerIteratorin interfaceHttpMessage- Parameters:
name- the name of the headers over which to iterate, ornullfor all headers- Returns:
- Iterator that returns Header objects with the argument name in the sequence they are sent over a connection.
-
getParams
Description copied from interface:HttpMessageReturns the parameters effective for this message as set byHttpMessage.setParams(HttpParams).- Specified by:
getParamsin interfaceHttpMessage
-
setParams
Description copied from interface:HttpMessageProvides parameters to be used for the processing of this message.- Specified by:
setParamsin interfaceHttpMessage- Parameters:
params- the parameters
-