Package org.jboss.resteasy.specimpl
Class ResteasyHttpHeaders
- java.lang.Object
-
- org.jboss.resteasy.specimpl.ResteasyHttpHeaders
-
- All Implemented Interfaces:
HttpHeaders
public class ResteasyHttpHeaders extends Object implements HttpHeaders
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
-
Fields inherited from interface jakarta.ws.rs.core.HttpHeaders
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPECT, EXPIRES, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE, LAST_EVENT_ID_HEADER, LAST_MODIFIED, LINK, LOCATION, RETRY_AFTER, SET_COOKIE, USER_AGENT, VARY, WWW_AUTHENTICATE
-
-
Constructor Summary
Constructors Constructor Description ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders)ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, boolean eagerlyInitializeEntrySet)ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, Map<String,Cookie> cookies)ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, Map<String,Cookie> cookies, boolean eagerlyInitializeEntrySet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.DategetDate()Get message date.StringgetHeaderString(String name)Get a HTTP header as a single string value.LocalegetLanguage()Get the language of the request entity.intgetLength()Get Content-Length value.MediaTypegetMediaType()Get the media type of the request entity.Map<String,Cookie>getMutableCookies()MultivaluedMap<String,String>getMutableHeaders()List<String>getRequestHeader(String name)Get the values of a HTTP request header if the header exists on the current request.MultivaluedMap<String,String>getRequestHeaders()Get the values of HTTP request headers.voidsetCookies(Map<String,Cookie> cookies)voidtestParsing()
-
-
-
Constructor Detail
-
ResteasyHttpHeaders
public ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders)
-
ResteasyHttpHeaders
public ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, boolean eagerlyInitializeEntrySet)
-
ResteasyHttpHeaders
public ResteasyHttpHeaders(MultivaluedMap<String,String> requestHeaders, Map<String,Cookie> cookies)
-
-
Method Detail
-
getRequestHeaders
public MultivaluedMap<String,String> getRequestHeaders()
Description copied from interface:HttpHeadersGet the values of HTTP request headers. The returned Map is case-insensitive wrt. keys and is read-only. The method never returnsnull.- Specified by:
getRequestHeadersin interfaceHttpHeaders- Returns:
- a read-only map of header names and values.
-
getMutableHeaders
public MultivaluedMap<String,String> getMutableHeaders()
-
testParsing
public void testParsing()
-
getRequestHeader
public List<String> getRequestHeader(String name)
Description copied from interface:HttpHeadersGet the values of a HTTP request header if the header exists on the current request. The returned value will be a read-only List if the specified header exists ornullif it does not. This is a shortcut forgetRequestHeaders().get(name).- Specified by:
getRequestHeaderin interfaceHttpHeaders- Parameters:
name- the header name, case insensitive.- Returns:
- a read-only list of header values if the specified header exists, otherwise
null.
-
getCookies
public Map<String,Cookie> getCookies()
Description copied from interface:HttpHeadersGet any cookies that accompanied the request.- Specified by:
getCookiesin interfaceHttpHeaders- Returns:
- a read-only map of cookie name (String) to Cookie.
-
getDate
public Date getDate()
Description copied from interface:HttpHeadersGet message date.- Specified by:
getDatein interfaceHttpHeaders- Returns:
- the message date, otherwise
nullif not present.
-
getHeaderString
public String getHeaderString(String name)
Description copied from interface:HttpHeadersGet 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.- Specified by:
getHeaderStringin interfaceHttpHeaders- 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. - See Also:
HttpHeaders.getRequestHeader(java.lang.String)
-
getLanguage
public Locale getLanguage()
Description copied from interface:HttpHeadersGet the language of the request entity.- Specified by:
getLanguagein interfaceHttpHeaders- Returns:
- the language of the entity or
nullif not specified.
-
getLength
public int getLength()
Description copied from interface:HttpHeadersGet Content-Length value.- Specified by:
getLengthin interfaceHttpHeaders- Returns:
- Content-Length as integer if present and valid number. In other cases returns -1.
-
getMediaType
public MediaType getMediaType()
Description copied from interface:HttpHeadersGet the media type of the request entity.- Specified by:
getMediaTypein interfaceHttpHeaders- Returns:
- the media type or
nullif there is no request entity.
-
getAcceptableMediaTypes
public List<MediaType> getAcceptableMediaTypes()
Description copied from interface:HttpHeadersGet 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.- Specified by:
getAcceptableMediaTypesin interfaceHttpHeaders- Returns:
- a read-only list of requested response media types sorted according to their q-value, with highest preference first.
-
getAcceptableLanguages
public List<Locale> getAcceptableLanguages()
Description copied from interface:HttpHeadersGet 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.- Specified by:
getAcceptableLanguagesin interfaceHttpHeaders- Returns:
- a read-only list of acceptable languages sorted according to their q-value, with highest preference first.
-
-