org.glassfish.jersey.message.internal
Interface Headers


public interface Headers

Jersey message headers internal contract.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static interface Headers.Builder<B extends Headers.Builder>
          Jersey message headers builder internal contract.
 
Method Summary
 String header(String name)
          Get a HTTP header as a single string value.
 com.google.common.collect.ListMultimap<String,String> headers()
          Get the map of HTTP message header names to their respective values.
 List<String> headerValues(String name)
          Get the values of a single HTTP message header.
 javax.ws.rs.core.MultivaluedMap<String,String> toJaxrsHeaderMap()
          Get the map of HTTP message header names to their respective values.
 

Method Detail

header

String header(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(), toJaxrsHeaderMap()

headers

com.google.common.collect.ListMultimap<String,String> headers()
Get the map of HTTP message header names to their respective values. The returned map is case-insensitive wrt. keys and is read-only.

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 read-only map of header names and values.
Throws:
IllegalStateException - if called outside of the message processing scope.
See Also:
#getHeader(String), #getHeaderValues(String)

headerValues

List<String> headerValues(String name)
Get the values of a single HTTP message header. The returned List is read-only. 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 read-only list of header values.
Throws:
IllegalStateException - if called outside of the message processing scope.
See Also:
#getHeaderMap(), #getHeader(java.lang.String)

toJaxrsHeaderMap

javax.ws.rs.core.MultivaluedMap<String,String> toJaxrsHeaderMap()
Get the map of HTTP message header names to their respective values. The returned map is case-insensitive wrt. keys and is read-only.

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 read-only map of header names and values.
Throws:
IllegalStateException - if called outside of the message processing scope.
See Also:
#getHeader(java.lang.String), #getHeaderValues(java.lang.String)


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