public class HeaderGroup extends Object implements MessageHeaders, Serializable
| 构造器和说明 |
|---|
HeaderGroup()
Constructor for HeaderGroup.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHeader(Header header)
Adds the given header to the group.
|
void |
clear()
Removes all headers.
|
boolean |
containsHeader(String name)
Tests if headers with the given name are contained within this group.
|
int |
countHeaders(String name)
Checks if a certain header is present in this message and how many times.
|
Header |
getCondensedHeader(String name)
Gets a header representing all of the header values with the given name.
|
Header |
getFirstHeader(String name)
Gets the first header with the given name.
|
Header |
getHeader(String name)
Gets single first header with the given name.
|
Header[] |
getHeaders()
Gets all of the headers contained within this group.
|
Header[] |
getHeaders(String name)
Gets all of the headers with the given name.
|
Header |
getLastHeader(String name)
Gets the last header with the given name.
|
Iterator<Header> |
headerIterator()
Returns an iterator over this group of headers.
|
Iterator<Header> |
headerIterator(String name)
Returns an iterator over the headers with a given name in this group.
|
boolean |
removeHeader(Header header)
Removes the first given header.
|
boolean |
removeHeaders(Header header)
Removes all headers that match the given header.
|
boolean |
removeHeaders(String name)
Removes all headers with a given name in this group.
|
void |
setHeader(Header header)
Replaces the first occurrence of the header with the same name.
|
void |
setHeaders(Header... headers)
Sets all of the headers contained within this group overriding any
existing headers.
|
String |
toString() |
public void clear()
public void addHeader(Header header)
header - the header to addpublic boolean removeHeader(Header header)
header - the header to removetrue if a header was removed as a result of this call.public boolean removeHeaders(Header header)
header - the header to removetrue if any header was removed as a result of this call.public void setHeader(Header header)
header - the new header that should replace the first header with the same
name if present in the list.public void setHeaders(Header... headers)
headers - the headers to setpublic Header getCondensedHeader(String name)
Header name comparison is case insensitive.
name - the name of the header(s) to getnull if no
headers by the given name are presentpublic Header[] getHeaders(String name)
Header name comparison is case insensitive.
getHeaders 在接口中 MessageHeadersname - the name of the header(s) to getpublic Header getFirstHeader(String name)
Header name comparison is case insensitive.
getFirstHeader 在接口中 MessageHeadersname - the name of the header to getnullpublic Header getHeader(String name) throws ProtocolException
Header name comparison is case insensitive.
getHeader 在接口中 MessageHeadersname - the name of the header to getnullProtocolException - in case multiple headers with the given name are found.public Header getLastHeader(String name)
Header name comparison is case insensitive.
getLastHeader 在接口中 MessageHeadersname - the name of the header to getnullpublic Header[] getHeaders()
getHeaders 在接口中 MessageHeaderspublic boolean containsHeader(String name)
Header name comparison is case insensitive.
containsHeader 在接口中 MessageHeadersname - the header name to test fortrue if at least one header with the name is
contained, false otherwisepublic int countHeaders(String name)
Header name comparison is case insensitive.
countHeaders 在接口中 MessageHeadersname - the header name to check for.public Iterator<Header> headerIterator()
headerIterator 在接口中 MessageHeaderspublic Iterator<Header> headerIterator(String name)
headerIterator 在接口中 MessageHeadersname - the name of the headers over which to iterate, or
null for all headerspublic boolean removeHeaders(String name)
name - the name of the headers to be removed.true if any header was removed as a result of this call.Copyright © 2023. All rights reserved.