Package javax.ws.rs.core
Interface HttpHeaders
-
public interface HttpHeadersAn 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
Fields Modifier and Type Field Description static java.lang.StringACCEPTSee {@link HTTP/1.1 documentation}.static java.lang.StringACCEPT_CHARSETSee {@link HTTP/1.1 documentation}.static java.lang.StringACCEPT_ENCODINGSee {@link HTTP/1.1 documentation}.static java.lang.StringACCEPT_LANGUAGESee {@link HTTP/1.1 documentation}.static java.lang.StringAUTHORIZATIONSee {@link HTTP/1.1 documentation}.static java.lang.StringCACHE_CONTROLSee {@link HTTP/1.1 documentation}.static java.lang.StringCONTENT_ENCODINGSee {@link HTTP/1.1 documentation}.static java.lang.StringCONTENT_LANGUAGESee {@link HTTP/1.1 documentation}.static java.lang.StringCONTENT_LENGTHSee {@link HTTP/1.1 documentation}.static java.lang.StringCONTENT_LOCATIONSee {@link HTTP/1.1 documentation}.static java.lang.StringCONTENT_TYPESee {@link HTTP/1.1 documentation}.static java.lang.StringCOOKIESee {@link IETF RFC 2109}.static java.lang.StringDATESee {@link HTTP/1.1 documentation}.static java.lang.StringETAGSee {@link HTTP/1.1 documentation}.static java.lang.StringEXPIRESSee {@link HTTP/1.1 documentation}.static java.lang.StringHOSTSee {@link HTTP/1.1 documentation}.static java.lang.StringIF_MATCHSee {@link HTTP/1.1 documentation}.static java.lang.StringIF_MODIFIED_SINCESee {@link HTTP/1.1 documentation}.static java.lang.StringIF_NONE_MATCHSee {@link HTTP/1.1 documentation}.static java.lang.StringIF_UNMODIFIED_SINCESee {@link HTTP/1.1 documentation}.static java.lang.StringLAST_MODIFIEDSee {@link HTTP/1.1 documentation}.static java.lang.StringLOCATIONSee {@link HTTP/1.1 documentation}.static java.lang.StringSET_COOKIESee {@link IETF RFC 2109}.static java.lang.StringUSER_AGENTSee {@link HTTP/1.1 documentation}.static java.lang.StringVARYSee {@link HTTP/1.1 documentation}.static java.lang.StringWWW_AUTHENTICATESee {@link HTTP/1.1 documentation}.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<java.util.Locale>getAcceptableLanguages()Get a list of languages that are acceptable for the response.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.util.LocalegetLanguage()Get the language of the request entityMediaTypegetMediaType()Get the media type of the request entityjava.util.List<java.lang.String>getRequestHeader(java.lang.String name)Get the values of a HTTP request header.MultivaluedMap<java.lang.String,java.lang.String>getRequestHeaders()Get the values of HTTP request headers.
-
-
-
Field Detail
-
ACCEPT
static final java.lang.String ACCEPT
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
ACCEPT_CHARSET
static final java.lang.String ACCEPT_CHARSET
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
ACCEPT_ENCODING
static final java.lang.String ACCEPT_ENCODING
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
ACCEPT_LANGUAGE
static final java.lang.String ACCEPT_LANGUAGE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
AUTHORIZATION
static final java.lang.String AUTHORIZATION
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CACHE_CONTROL
static final java.lang.String CACHE_CONTROL
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CONTENT_ENCODING
static final java.lang.String CONTENT_ENCODING
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CONTENT_LANGUAGE
static final java.lang.String CONTENT_LANGUAGE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CONTENT_LENGTH
static final java.lang.String CONTENT_LENGTH
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CONTENT_LOCATION
static final java.lang.String CONTENT_LOCATION
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
CONTENT_TYPE
static final java.lang.String CONTENT_TYPE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
DATE
static final java.lang.String DATE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
ETAG
static final java.lang.String ETAG
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
EXPIRES
static final java.lang.String EXPIRES
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
HOST
static final java.lang.String HOST
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
IF_MATCH
static final java.lang.String IF_MATCH
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
IF_MODIFIED_SINCE
static final java.lang.String IF_MODIFIED_SINCE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
IF_NONE_MATCH
static final java.lang.String IF_NONE_MATCH
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
IF_UNMODIFIED_SINCE
static final java.lang.String IF_UNMODIFIED_SINCE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
LAST_MODIFIED
static final java.lang.String LAST_MODIFIED
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
LOCATION
static final java.lang.String LOCATION
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
USER_AGENT
static final java.lang.String USER_AGENT
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
VARY
static final java.lang.String VARY
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
WWW_AUTHENTICATE
static final java.lang.String WWW_AUTHENTICATE
See {@link HTTP/1.1 documentation}.- See Also:
- Constant Field Values
-
COOKIE
static final java.lang.String COOKIE
See {@link IETF RFC 2109}.- See Also:
- Constant Field Values
-
SET_COOKIE
static final java.lang.String SET_COOKIE
See {@link IETF RFC 2109}.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRequestHeader
java.util.List<java.lang.String> getRequestHeader(java.lang.String name)
Get the values of a HTTP request header. The returned List is read-only. This is a shortcut forgetRequestHeaders().get(name).- Parameters:
name- the header name, case insensitive- Returns:
- a read-only list of header values.
- Throws:
java.lang.IllegalStateException- if called outside the scope of a request
-
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 read-only 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:
- a read-only list of requested response media types sorted according to their q-value, with highest preference first.
- Throws:
java.lang.IllegalStateException- if called outside the scope of a request
-
getAcceptableLanguages
java.util.List<java.util.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:
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.util.Locale 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 read-only map of cookie name (String) to Cookie.
- Throws:
java.lang.IllegalStateException- if called outside the scope of a request
-
-