public class Headers
extends java.lang.Object
Holds transport headers for a message. This object is returned from
Message.getTransportHeaders()
as follows:
The headers in this collection are represented by theheaders = message.getTransportHeaders();
Header
object.
The following retrieves a header:
header = headers.get("Authentication");
This collection of headers can be changed. It supports the addition, changing, and removing of headers. The following will add or change a header:
headers.add("Content-Type", "application/xml");
The following will remove a header:
headers.remove("Authentication");
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String name,
java.util.Date value)
Adds a date header.
|
void |
add(java.lang.String name,
java.lang.String value)
Adds a header.
|
boolean |
contains(java.lang.String name)
Returns whether or not a header with the given name exists.
|
Header |
get(java.lang.String name)
Returns the
Header object for the given header name, null if no
header with the given name is present. |
Header[] |
getArray()
Returns the headers as an array of
Header . |
Header |
getDate(java.lang.String name)
Returns the
Header object for the given header name as a date,
null if no header with the given name is present. |
void |
remove(java.lang.String name)
Removes the headaer with the given name.
|
public Header[] getArray()
Header
. Changes to the
returned array are not reflected in this object.public Header get(java.lang.String name)
Header
object for the given header name, null if no
header with the given name is present.name
- Name of the header to return. Name lookup is case-insensitive.public Header getDate(java.lang.String name)
Header
object for the given header name as a date,
null if no header with the given name is present.name
- Name of the header to return. Name lookup is case-insensitive.public void add(java.lang.String name, java.lang.String value) throws GException
name
- The header name. Name lookup is case-insensitive.value
- The header value. This may include any parameters, and
may be multi-valued with each value separated by a comma.GException
- Thrown if the header could not be parsed.public void add(java.lang.String name, java.util.Date value) throws GException
name
- The header name. Name lookup is case-insensitive.value
- The header value as a Date.GException
- Thrown if the header could not be parsed.public void remove(java.lang.String name)
name
- The header name. Name lookup is case-insensitive.public boolean contains(java.lang.String name)
name
- The header name. Name lookup is case-insensitive.?? 2022 Perforce Software, All rights reserved
This software is the confidential and proprietary information of Perforce, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Perforce, Inc.