public interface HttpMessage
HTTP-message = Request | Response ; HTTP/1.1 messages
HTTP messages use the generic message format of RFC 822 for transferring entities (the payload of the message). Both types of message consist of a start-line, zero or more header fields (also known as "headers"), an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields, and possibly a message-body.
generic-message = start-line *(message-header CRLF) CRLF [ message-body ] start-line = Request-Line | Status-Line
Modifier and Type | Method and Description |
---|---|
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()
Deprecated.
(4.3) use configuration classes provided 'org.apache.http.config'
and 'org.apache.http.client.config'
|
ProtocolVersion |
getProtocolVersion()
Returns the protocol version this message is compatible with.
|
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)
Deprecated.
(4.3) use configuration classes provided 'org.apache.http.config'
and 'org.apache.http.client.config'
|
ProtocolVersion getProtocolVersion()
boolean containsHeader(String name)
name
- the header name to check for.Header[] getHeaders(String name)
name
- the name of the headers to return.name
.Header getFirstHeader(String name)
getHeaders(String)
is returned.
If there is no matching header in the message null
is
returned.name
- the name of the header to return.name
or null
if no such header could be found.Header getLastHeader(String name)
getHeaders(String)
is returned. If there is no
matching header in the message null
is returned.name
- the name of the header to return.name
.
or null
if no such header could be found.Header[] getAllHeaders()
void addHeader(Header header)
header
- the header to append.void addHeader(String name, String value)
name
- the name of the header.value
- the value of the header.void setHeader(Header header)
header
- the header to set.void setHeader(String name, String value)
name
- the name of the header.value
- the value of the header.void setHeaders(Header[] headers)
headers
- the array of headers to set.void removeHeader(Header header)
header
- the header to remove.void removeHeaders(String name)
name
- The name of the headers to remove.HeaderIterator headerIterator()
HeaderIterator headerIterator(String name)
name
- the name of the headers over which to iterate, or
null
for all headers@Deprecated HttpParams getParams()
setParams(HttpParams)
.@Deprecated void setParams(HttpParams params)
params
- the parametersCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.