org.glassfish.jersey.message.internal
Interface Headers


public interface Headers

Jersey message headers internal contract.

Author:
Marek Potociar (marek.potociar at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Nested Class Summary
static interface Headers.Builder<B extends Headers.Builder>
          Jersey message headers builder internal contract.
 
Method Summary
 java.lang.String header(java.lang.String name)
          Get a HTTP header as a single string value.
 MultivaluedMap<java.lang.String,java.lang.String> headers()
          Get the map of HTTP message header names to their respective values.
 java.util.List<java.lang.String> headerValues(java.lang.String name)
          Get the values of a single HTTP message header.
 

Method Detail

header

java.lang.String header(java.lang.String name)
Get a HTTP header as a single string value.

Each single header value is converted to String using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the header value class or using its toString method if a header delegate is not available.

Parameters:
name - the HTTP header.
Returns:
the HTTP header value. If the HTTP header is not present then null is returned. If the HTTP header is present but has no value then the empty string is returned. If the HTTP header is present more than once then the values of joined together and separated by a ',' character.
See Also:
headerValues(String), headers()

headers

MultivaluedMap<java.lang.String,java.lang.String> headers()
Get the map of HTTP message header names to their respective values. The returned map is case-insensitive wrt. keys and is mutable.

Each single header value is converted to String using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the header value class or using its toString method if a header delegate is not available.

Returns:
a mutable map of header names and values.
Throws:
java.lang.IllegalStateException - if called outside of the message processing scope.
See Also:
header(String), headerValues(String)

headerValues

java.util.List<java.lang.String> headerValues(java.lang.String name)
Get the values of a single HTTP message header. The returned List is mutable. This is a convenience shortcut for headers().get(name).

Each single header value is converted to String using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the header value class or using its toString method if a header delegate is not available.

Parameters:
name - the header name, case insensitive.
Returns:
a mutable list of header values or null if no header value exists for the header name.
Throws:
java.lang.IllegalStateException - if called outside of the message processing scope.
See Also:
headers(), header(java.lang.String)


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.