Package com.newrelic.api.agent
Interface Headers
-
- All Superinterfaces:
InboundHeaders
,OutboundHeaders
- All Known Implementing Classes:
ConcurrentHashMapHeaders
public interface Headers extends InboundHeaders, OutboundHeaders
The type-specific headers of an inbound or outbound message.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addHeader(java.lang.String name, java.lang.String value)
Add a header with the given name and value.boolean
containsHeader(java.lang.String name)
Return a boolean indicating whether the named header has already been set.java.lang.String
getHeader(java.lang.String name)
Returns the value of the first specified message header as aString
.java.util.Collection<java.lang.String>
getHeaderNames()
Get the names of the headers.java.util.Collection<java.lang.String>
getHeaders(java.lang.String name)
Return all the values of the specified message header as aList
ofString
objects.HeaderType
getHeaderType()
Return the type of header key syntax used for this.void
setHeader(java.lang.String name, java.lang.String value)
Set a header with the given name and value.
-
-
-
Method Detail
-
getHeaderType
HeaderType getHeaderType()
Return the type of header key syntax used for this.- Specified by:
getHeaderType
in interfaceInboundHeaders
- Specified by:
getHeaderType
in interfaceOutboundHeaders
- Returns:
- An
enum
specifying the type of headers present.
-
getHeader
java.lang.String getHeader(java.lang.String name)
Returns the value of the first specified message header as aString
. If the message does not include a header with the specified input name, then this method returnsnull
.- Specified by:
getHeader
in interfaceInboundHeaders
- Parameters:
name
- The name of the desired message header.- Returns:
- A
String
containing the value of the requested header, ornull
if the message header is not present.
-
getHeaders
java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
Return all the values of the specified message header as aList
ofString
objects. If the message does not include any headers of the specified name, this method returns an empty list.Changes to the returned collection must not affect the Headers instance.
- Parameters:
name
- The name of the desired message header.- Returns:
- A
List
containing the values of the requested header, or an empty list of the message header is not present.
-
setHeader
void setHeader(java.lang.String name, java.lang.String value)
Set a header with the given name and value. If the header had already been set, the new value overwrites the previous one.containsHeader(String)
can be used to test for the presence of a header before setting its value.- Specified by:
setHeader
in interfaceOutboundHeaders
- Parameters:
name
- The name of the header.value
- The value of the header.
-
addHeader
void addHeader(java.lang.String name, java.lang.String value)
Add a header with the given name and value. This method allows headers to have multiple values.- Parameters:
name
- The name of the header.value
- The value of the header.
-
getHeaderNames
java.util.Collection<java.lang.String> getHeaderNames()
Get the names of the headers.Changes to the returned collection must not affect the Headers instance.
- Returns:
- A possibly empty
Collection
of the names of present headers.
-
containsHeader
boolean containsHeader(java.lang.String name)
Return a boolean indicating whether the named header has already been set.- Parameters:
name
- The name of the header.- Returns:
true
if the header has already been set,false
otherwise.
-
-