javax.ws.rs.core
Interface HttpHeaders

All Known Implementing Classes:
HttpHeadersImpl

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

Field Summary
static String ACCEPT
          See HTTP/1.1 documentation.
static String ACCEPT_CHARSET
          See HTTP/1.1 documentation.
static String ACCEPT_ENCODING
          See HTTP/1.1 documentation.
static String ACCEPT_LANGUAGE
          See HTTP/1.1 documentation.
static String AUTHORIZATION
          See HTTP/1.1 documentation.
static String CACHE_CONTROL
          See HTTP/1.1 documentation.
static String CONTENT_ENCODING
          See HTTP/1.1 documentation.
static String CONTENT_LANGUAGE
          See HTTP/1.1 documentation.
static String CONTENT_LENGTH
          See HTTP/1.1 documentation.
static String CONTENT_LOCATION
          See HTTP/1.1 documentation.
static String CONTENT_TYPE
          See HTTP/1.1 documentation.
static String COOKIE
          See IETF RFC 2109.
static String DATE
          See HTTP/1.1 documentation.
static String ETAG
          See HTTP/1.1 documentation.
static String EXPIRES
          See HTTP/1.1 documentation.
static String HOST
          See HTTP/1.1 documentation.
static String IF_MATCH
          See HTTP/1.1 documentation.
static String IF_MODIFIED_SINCE
          See HTTP/1.1 documentation.
static String IF_NONE_MATCH
          See HTTP/1.1 documentation.
static String IF_UNMODIFIED_SINCE
          See HTTP/1.1 documentation.
static String LAST_MODIFIED
          See HTTP/1.1 documentation.
static String LOCATION
          See HTTP/1.1 documentation.
static String SET_COOKIE
          See IETF RFC 2109.
static String USER_AGENT
          See HTTP/1.1 documentation.
static String VARY
          See HTTP/1.1 documentation.
static String WWW_AUTHENTICATE
          See HTTP/1.1 documentation.
 
Method Summary
 List<Locale> getAcceptableLanguages()
          Get a list of languages that are acceptable for the response.
 List<MediaType> getAcceptableMediaTypes()
          Get a list of media types that are acceptable for the response.
 Map<String,Cookie> getCookies()
          Get any cookies that accompanied the request.
 Locale getLanguage()
          Get the language of the request entity
 MediaType getMediaType()
          Get the media type of the request entity
 List<String> getRequestHeader(String name)
          Get the values of a HTTP request header.
 MultivaluedMap<String,String> getRequestHeaders()
          Get the values of HTTP request headers.
 

Field Detail

ACCEPT

static final String ACCEPT
See HTTP/1.1 documentation.

See Also:
Constant Field Values

ACCEPT_CHARSET

static final String ACCEPT_CHARSET
See HTTP/1.1 documentation.

See Also:
Constant Field Values

ACCEPT_ENCODING

static final String ACCEPT_ENCODING
See HTTP/1.1 documentation.

See Also:
Constant Field Values

ACCEPT_LANGUAGE

static final String ACCEPT_LANGUAGE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

AUTHORIZATION

static final String AUTHORIZATION
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CACHE_CONTROL

static final String CACHE_CONTROL
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CONTENT_ENCODING

static final String CONTENT_ENCODING
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CONTENT_LANGUAGE

static final String CONTENT_LANGUAGE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CONTENT_LENGTH

static final String CONTENT_LENGTH
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CONTENT_LOCATION

static final String CONTENT_LOCATION
See HTTP/1.1 documentation.

See Also:
Constant Field Values

CONTENT_TYPE

static final String CONTENT_TYPE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

DATE

static final String DATE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

ETAG

static final String ETAG
See HTTP/1.1 documentation.

See Also:
Constant Field Values

EXPIRES

static final String EXPIRES
See HTTP/1.1 documentation.

See Also:
Constant Field Values

HOST

static final String HOST
See HTTP/1.1 documentation.

See Also:
Constant Field Values

IF_MATCH

static final String IF_MATCH
See HTTP/1.1 documentation.

See Also:
Constant Field Values

IF_MODIFIED_SINCE

static final String IF_MODIFIED_SINCE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

IF_NONE_MATCH

static final String IF_NONE_MATCH
See HTTP/1.1 documentation.

See Also:
Constant Field Values

IF_UNMODIFIED_SINCE

static final String IF_UNMODIFIED_SINCE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

LAST_MODIFIED

static final String LAST_MODIFIED
See HTTP/1.1 documentation.

See Also:
Constant Field Values

LOCATION

static final String LOCATION
See HTTP/1.1 documentation.

See Also:
Constant Field Values

USER_AGENT

static final String USER_AGENT
See HTTP/1.1 documentation.

See Also:
Constant Field Values

VARY

static final String VARY
See HTTP/1.1 documentation.

See Also:
Constant Field Values

WWW_AUTHENTICATE

static final String WWW_AUTHENTICATE
See HTTP/1.1 documentation.

See Also:
Constant Field Values

COOKIE

static final String COOKIE
See IETF RFC 2109.

See Also:
Constant Field Values

SET_COOKIE

static final String SET_COOKIE
See IETF RFC 2109.

See Also:
Constant Field Values
Method Detail

getRequestHeader

List<String> getRequestHeader(String name)
Get the values of a HTTP request header. The returned List is read-only. This is a shortcut for getRequestHeaders().get(name).

Parameters:
name - the header name, case insensitive
Returns:
a read-only list of header values.
Throws:
IllegalStateException - if called outside the scope of a request

getRequestHeaders

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

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

getAcceptableMediaTypes

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

Returns:
a read-only list of requested response media types sorted according to their q-value, with highest preference first.
Throws:
IllegalStateException - if called outside the scope of a request

getAcceptableLanguages

List<Locale> getAcceptableLanguages()
Get a list of languages that are acceptable for the response.

Returns:
a read-only list of acceptable languages sorted according to their q-value, with highest preference first.
Throws:
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:
IllegalStateException - if called outside the scope of a request

getLanguage

Locale getLanguage()
Get the language of the request entity

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

getCookies

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

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


Copyright © 2012. All Rights Reserved.