Package javax.ws.rs.core
Interface HttpHeaders
public interface HttpHeaders
An injectable interface that provides access to HTTP header information.
All methods throw
IllegalStateException if called outside the
scope of a request (e.g. from a provider constructor).- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">HTTP/1.1static final StringSeeRFC-2183}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc2183">IETFstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">HTTP/1.1static final StringSeeRFC-2392}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc2392">IETFstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">HTTP/1.1static final StringSeeRFC 2109}.invalid @link
{@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETFstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28">HTTP/1.1static final String"Last-Event-ID"HTTP request header name as defined by SSE specification.static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29">HTTP/1.1static final StringSeeLinking (IETF RFC-5988) documentation}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc5988#page-6">Webstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37">HTTP/1.1static final StringSeeRFC 2109}.invalid @link
{@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETFstatic final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44">HTTP/1.1static final StringSeedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47">HTTP/1.1 -
Method Summary
Modifier and TypeMethodDescriptionGet a list of languages that are acceptable for the response.Get a list of media types that are acceptable for the response.Get any cookies that accompanied the request.getDate()Get message date.getHeaderString(String name) Get a HTTP header as a single string value.Get the language of the request entity.intGet Content-Length value.Get the media type of the request entity.getRequestHeader(String name) Get the values of a HTTP request header.Get the values of HTTP request headers.
-
Field Details
-
ACCEPT
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1- See Also:
-
ACCEPT_CHARSET
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2">HTTP/1.1- See Also:
-
ACCEPT_ENCODING
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3">HTTP/1.1- See Also:
-
ACCEPT_LANGUAGE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4">HTTP/1.1- See Also:
-
ALLOW
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7">HTTP/1.1- See Also:
-
AUTHORIZATION
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8">HTTP/1.1- See Also:
-
CACHE_CONTROL
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">HTTP/1.1- See Also:
-
CONTENT_DISPOSITION
SeeRFC-2183}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc2183">IETF- See Also:
-
CONTENT_ENCODING
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">HTTP/1.1- See Also:
-
CONTENT_ID
SeeRFC-2392}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc2392">IETF- See Also:
-
CONTENT_LANGUAGE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12">HTTP/1.1- See Also:
-
CONTENT_LENGTH
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">HTTP/1.1- See Also:
-
CONTENT_LOCATION
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14">HTTP/1.1- See Also:
-
CONTENT_TYPE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">HTTP/1.1- See Also:
-
DATE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18">HTTP/1.1- See Also:
-
ETAG
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">HTTP/1.1- See Also:
-
EXPIRES
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">HTTP/1.1- See Also:
-
HOST
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23">HTTP/1.1- See Also:
-
IF_MATCH
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24">HTTP/1.1- See Also:
-
IF_MODIFIED_SINCE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25">HTTP/1.1- See Also:
-
IF_NONE_MATCH
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26">HTTP/1.1- See Also:
-
IF_UNMODIFIED_SINCE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28">HTTP/1.1- See Also:
-
LAST_MODIFIED
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29">HTTP/1.1- See Also:
-
LOCATION
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30">HTTP/1.1- See Also:
-
LINK
SeeLinking (IETF RFC-5988) documentation}.invalid @link
{@link <a href="http://tools.ietf.org/html/rfc5988#page-6">Web- See Also:
-
RETRY_AFTER
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37">HTTP/1.1- See Also:
-
USER_AGENT
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">HTTP/1.1- See Also:
-
VARY
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44">HTTP/1.1- See Also:
-
WWW_AUTHENTICATE
Seedocumentation}.invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47">HTTP/1.1- See Also:
-
COOKIE
SeeRFC 2109}.invalid @link
{@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF- See Also:
-
SET_COOKIE
SeeRFC 2109}.invalid @link
{@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF- See Also:
-
LAST_EVENT_ID_HEADER
"Last-Event-ID"HTTP request header name as defined by SSE specification.- Since:
- 2.1
- See Also:
-
-
Method Details
-
getRequestHeader
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:
IllegalStateException- if called outside the scope of a request.
-
getHeaderString
Get a HTTP header as a single string value. Each single header value is converted to String using aRuntimeDelegate.HeaderDelegateif one is available viaRuntimeDelegate.createHeaderDelegate(java.lang.Class)for the header value class or using itstoStringmethod 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
nullis 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. - Since:
- 2.0
- See Also:
-
getRequestHeaders
MultivaluedMap<String,String> getRequestHeaders()Get the values of HTTP request headers. The returned Map is case-insensitive wrt. keys and is read-only. The method never returnsnull.- Returns:
- a read-only map of header names and values.
- Throws:
IllegalStateException- if called outside the scope of a request.
-
getAcceptableMediaTypes
Get a list of media types that are acceptable for the response. If no acceptable media types are specified, a read-only list containing a singlewildcard media typeinstance is returned.- 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
Get a list of languages that are acceptable for the response. If no acceptable languages are specified, a read-only list containing a single wildcardLocaleinstance (with language field set to "*") is returned.- 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
nullif 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
nullif not specified. - Throws:
IllegalStateException- if called outside the scope of a request.
-
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
-
getDate
Date getDate()Get message date.- Returns:
- the message date, otherwise
nullif not present. - Since:
- 2.0
-
getLength
int getLength()Get Content-Length value.- Returns:
- Content-Length as integer if present and valid number. In other cases returns -1.
- Since:
- 2.0
-