javax.ws.rs.core
Interface HttpHeaders


public interface HttpHeaders

An injectable interface that provides access to HTTP header information. All methods throw java.lang.IllegalStateException if called outside the scope of a request (e.g. from a provider constructor).

See Also:
Context

Method Summary
 java.util.List<MediaType> getAcceptableMediaTypes()
          Get a list of media types that are acceptable for the response.
 java.util.Map<java.lang.String,Cookie> getCookies()
          Get any cookies that accompanied the request.
 java.lang.String getLanguage()
          Get the language of the request entity
 MediaType getMediaType()
          Get the media type of the request entity
 MultivaluedMap<java.lang.String,java.lang.String> getRequestHeaders()
          Get the values of HTTP request headers.
 

Method Detail

getRequestHeaders

MultivaluedMap<java.lang.String,java.lang.String> getRequestHeaders()
Get the values of HTTP request headers. The returned Map is case-insensitive wrt keys and is read-only.

Returns:
a map of header names and values.
Throws:
java.lang.IllegalStateException - if called outside the scope of a request

getAcceptableMediaTypes

java.util.List<MediaType> getAcceptableMediaTypes()
Get a list of media types that are acceptable for the response.

Returns:
list of requested response media types
Throws:
java.lang.IllegalStateException - if called outside the scope of a request

getMediaType

MediaType getMediaType()
Get the media type of the request entity

Returns:
the media type or null if there is no request entity.
Throws:
java.lang.IllegalStateException - if called outside the scope of a request

getLanguage

java.lang.String getLanguage()
Get the language of the request entity

Returns:
the language of the entity or null if not specified
Throws:
java.lang.IllegalStateException - if called outside the scope of a request

getCookies

java.util.Map<java.lang.String,Cookie> getCookies()
Get any cookies that accompanied the request.

Returns:
a map of cookie name (String) to Cookie.
Throws:
java.lang.IllegalStateException - if called outside the scope of a request