Class ContainerRequest
- java.lang.Object
-
- org.glassfish.jersey.message.internal.InboundMessageContext
-
- org.glassfish.jersey.server.ContainerRequest
-
- All Implemented Interfaces:
ContainerRequestContext,HttpHeaders,Request,PropertiesDelegate,PropertiesResolver
public class ContainerRequest extends InboundMessageContext implements ContainerRequestContext, Request, HttpHeaders, PropertiesDelegate, PropertiesResolver
Jersey container request context. An instance of the request context is passed by the container to theApplicationHandlerfor each incoming client request.- Author:
- Marek Potociar
-
-
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 ContainerRequest(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate)Deprecated.ContainerRequest(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate, Configuration configuration)Create new Jersey container request context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortWith(Response response)Abort the filter chain with a response.Response.ResponseBuilderevaluatePreconditions()Evaluate request preconditions for a resource that does not currently exist.Response.ResponseBuilderevaluatePreconditions(EntityTag eTag)Evaluate request preconditions based on the passed in value.Response.ResponseBuilderevaluatePreconditions(Date lastModified)Evaluate request preconditions based on the passed in value.Response.ResponseBuilderevaluatePreconditions(Date lastModified, EntityTag eTag)Evaluate request preconditions based on the passed in value.ResponsegetAbortResponse()Get the request filter chain aborting response if set, ornullotherwise.URIgetAbsolutePath()Get the absolute path of the request.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.URIgetBaseUri()Get base request URI.Map<String,Cookie>getCookies()Get any cookies that accompanied the request.StringgetMethod()Get the request method.StringgetPath(boolean decode)Get the path of the current request relative to the application root (base) URI as a string.PropertiesDelegategetPropertiesDelegate()Get the underlying properties delegate.ObjectgetProperty(String name)Returns the property with the given name registered in the current request/response exchange context, ornullif there is no property by that name.Collection<String>getPropertyNames()Returns an immutablecollectioncontaining the property names available within the context of the current request/response exchange context.protected Iterable<ReaderInterceptor>getReaderInterceptors()Get all reader interceptors applicable to this request.RequestgetRequest()Get the injectable request information.List<String>getRequestHeader(String name)Get the values of an HTTP request header if the header exists on the current request.MultivaluedMap<String,String>getRequestHeaders()Get the values of HTTP request headers.RequestScopedInitializergetRequestScopedInitializer()Get a custom container extensions initializer for the current request.URIgetRequestUri()Get request URI.ContainerResponseWritergetResponseWriter()Get the container response writer for the current request.SecurityContextgetSecurityContext()Get the injectable security context information for the current request.ExtendedUriInfogetUriInfo()Get request URI information.StringgetVaryValue()Get the value of HTTP Vary response header to be set in the response, ornullif no value is to be set.voidinResponseProcessing()Notify this request that the response created from this request is already being processed.<T> TreadEntity(Class<T> rawType)Read entity from a context entity input stream.<T> TreadEntity(Class<T> rawType, Annotation[] annotations)Read entity from a context entity input stream.<T> TreadEntity(Class<T> rawType, Type type)Read entity from a context entity input stream.<T> TreadEntity(Class<T> rawType, Type type, Annotation[] annotations)Read entity from a context entity input stream.voidremoveProperty(String name)Removes a property with the given name from the current request/response exchange context.<T> TresolveProperty(String name, Class<T> type)Resolve a property value for the specified propertyname.<T> TresolveProperty(String name, T defaultValue)Resolve a property value for the specified propertyname.VariantselectVariant(List<Variant> variants)Select the representation variant that best matches the request.voidsetEntityStream(InputStream input)Set a new entity input stream.voidsetMethod(String method)Set the request method.voidsetMethodWithoutException(String method)LikesetMethod(String)but does not throwIllegalStateExceptionif the method is invoked in other than pre-matching phase.voidsetProperty(String name, Object object)Binds an object to a given property name in the current request/response exchange context.voidsetRequestScopedInitializer(RequestScopedInitializer requestScopedInitializer)Set a custom container extensions initializer for the current request.voidsetRequestUri(URI requestUri)Set a new request URI using the current base URI of the application to resolve the application-specific request URI part.voidsetRequestUri(URI baseUri, URI requestUri)Set a new request URI using a new base URI to resolve the application-specific request URI part.voidsetSecurityContext(SecurityContext context)Set a new injectable security context information for the current request.voidsetWriter(ContainerResponseWriter responseWriter)Set the container response writer for the current request.-
Methods inherited from class org.glassfish.jersey.message.internal.InboundMessageContext
bufferEntity, close, getAllowedMethods, getConfiguration, getDate, getEntityStream, getEntityTag, getHeaders, getHeaderString, getIfMatch, getIfNoneMatch, getLanguage, getLastModified, getLength, getLink, getLinkBuilder, getLinks, getLocation, getMediaType, getQualifiedAcceptableLanguages, getQualifiedAcceptableMediaTypes, getQualifiedAcceptCharset, getQualifiedAcceptEncoding, getRequestCookies, getResponseCookies, getWorkers, hasEntity, hasLink, header, headers, headers, headers, headers, readEntity, readEntity, readEntity, readEntity, remove, setWorkers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.ws.rs.container.ContainerRequestContext
getDate, getEntityStream, getHeaders, getHeaderString, getLanguage, getLength, getMediaType, hasEntity, hasProperty
-
Methods inherited from interface jakarta.ws.rs.core.HttpHeaders
getDate, getHeaderString, getLanguage, getLength, getMediaType
-
-
-
-
Constructor Detail
-
ContainerRequest
public ContainerRequest(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate, Configuration configuration)
Create new Jersey container request context.- Parameters:
baseUri- base application URI.requestUri- request URI.httpMethod- request HTTP method name.securityContext- security context of the current request. Must not benull. TheSecurityContext.getUserPrincipal()must returnnullif the current request has not been authenticated by the container.propertiesDelegate- customproperties delegateto be used by the context.configuration- the serverConfiguration. Ifnull, the default behaviour is expected.
-
ContainerRequest
@Deprecated public ContainerRequest(URI baseUri, URI requestUri, String httpMethod, SecurityContext securityContext, PropertiesDelegate propertiesDelegate)
Deprecated.Create new Jersey container request context.- Parameters:
baseUri- base application URI.requestUri- request URI.httpMethod- request HTTP method name.securityContext- security context of the current request. Must not benull. TheSecurityContext.getUserPrincipal()must returnnullif the current request has not been authenticated by the container.propertiesDelegate- customproperties delegateto be used by the context.- See Also:
ContainerRequest(URI, URI, String, SecurityContext, PropertiesDelegate, Configuration)
-
-
Method Detail
-
getRequestScopedInitializer
public RequestScopedInitializer getRequestScopedInitializer()
Get a custom container extensions initializer for the current request. The initializer is guaranteed to be run from within the request scope of the current request.- Returns:
- custom container extensions initializer or
nullif not available.
-
setRequestScopedInitializer
public void setRequestScopedInitializer(RequestScopedInitializer requestScopedInitializer)
Set a custom container extensions initializer for the current request. The initializer is guaranteed to be run from within the request scope of the current request.- Parameters:
requestScopedInitializer- custom container extensions initializer.
-
getResponseWriter
public ContainerResponseWriter getResponseWriter()
Get the container response writer for the current request.- Returns:
- container response writer.
-
setWriter
public void setWriter(ContainerResponseWriter responseWriter)
Set the container response writer for the current request.- Parameters:
responseWriter- container response writer. Must not benull.
-
readEntity
public <T> T readEntity(Class<T> rawType)
Read entity from a context entity input stream.- Type Parameters:
T- entity Java object type.- Parameters:
rawType- raw Java entity type.- Returns:
- entity read from a context entity input stream.
-
readEntity
public <T> T readEntity(Class<T> rawType, Annotation[] annotations)
Read entity from a context entity input stream.- Type Parameters:
T- entity Java object type.- Parameters:
rawType- raw Java entity type.annotations- entity annotations.- Returns:
- entity read from a context entity input stream.
-
readEntity
public <T> T readEntity(Class<T> rawType, Type type)
Read entity from a context entity input stream.- Type Parameters:
T- entity Java object type.- Parameters:
rawType- raw Java entity type.type- generic Java entity type.- Returns:
- entity read from a context entity input stream.
-
readEntity
public <T> T readEntity(Class<T> rawType, Type type, Annotation[] annotations)
Read entity from a context entity input stream.- Type Parameters:
T- entity Java object type.- Parameters:
rawType- raw Java entity type.type- generic Java entity type.annotations- entity annotations.- Returns:
- entity read from a context entity input stream.
-
resolveProperty
public <T> T resolveProperty(String name, Class<T> type)
Description copied from interface:PropertiesResolverResolve a property value for the specified propertyname.The method returns the value of the property registered in the request-specific property bag, if available. If no property for the given property name is found in the request-specific property bag, the method looks at the properties stored in the
global runtime configurationthis request belongs to. If there is a value defined in the runtime configuration, it is returned, otherwise the method returnsnullif no such property is registered neither in the runtime nor in the request-specific property bag.- Specified by:
resolvePropertyin interfacePropertiesResolver- Type Parameters:
T- property Java type.- Parameters:
name- property name.type- expected property class type.- Returns:
- resolved property value or
nullif no such property is registered.
-
resolveProperty
public <T> T resolveProperty(String name, T defaultValue)
Description copied from interface:PropertiesResolverResolve a property value for the specified propertyname.The method returns the value of the property registered in the request-specific property bag, if available. If no property for the given property name is found in the request-specific property bag, the method looks at the properties stored in the
global runtime configurationthis request belongs to. If there is a value defined in the runtime configuration, it is returned, otherwise the method returnsdefaultValueif no such property is registered neither in the runtime nor in the request-specific property bag.- Specified by:
resolvePropertyin interfacePropertiesResolver- Type Parameters:
T- property Java type.- Parameters:
name- property name.defaultValue- default value to return if the property is not registered.- Returns:
- resolved property value or
defaultValueif no such property is registered.
-
getProperty
public Object getProperty(String name)
Description copied from interface:ContainerRequestContextReturns the property with the given name registered in the current request/response exchange context, ornullif there is no property by that name.A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using
ContainerRequestContext.getPropertyNames(). Custom property names should follow the same convention as package names.In a Servlet container, the properties are synchronized with the
ServletRequestand expose all the attributes available in theServletRequest. Any modifications of the properties are also reflected in the set of properties of the associatedServletRequest.- Specified by:
getPropertyin interfaceContainerRequestContext- Specified by:
getPropertyin interfacePropertiesDelegate- Parameters:
name- aStringspecifying the name of the property.- Returns:
- an
Objectcontaining the value of the property, ornullif no property exists matching the given name. - See Also:
ContainerRequestContext.getPropertyNames()
-
getPropertyNames
public Collection<String> getPropertyNames()
Description copied from interface:ContainerRequestContextReturns an immutablecollectioncontaining the property names available within the context of the current request/response exchange context.Use the
ContainerRequestContext.getProperty(java.lang.String)method with a property name to get the value of a property.In a Servlet container, the properties are synchronized with the
ServletRequestand expose all the attributes available in theServletRequest. Any modifications of the properties are also reflected in the set of properties of the associatedServletRequest.- Specified by:
getPropertyNamesin interfaceContainerRequestContext- Specified by:
getPropertyNamesin interfacePropertiesDelegate- Returns:
- an immutable
collectionof property names. - See Also:
ContainerRequestContext.getProperty(java.lang.String)
-
setProperty
public void setProperty(String name, Object object)
Description copied from interface:ContainerRequestContextBinds an object to a given property name in the current request/response exchange context. If the name specified is already used for a property, this method will replace the value of the property with the new value.A property allows a JAX-RS filters and interceptors to exchange additional custom information not already provided by this interface.
A list of supported properties can be retrieved using
ContainerRequestContext.getPropertyNames(). Custom property names should follow the same convention as package names.If a
nullvalue is passed, the effect is the same as calling theContainerRequestContext.removeProperty(String)method.In a Servlet container, the properties are synchronized with the
ServletRequestand expose all the attributes available in theServletRequest. Any modifications of the properties are also reflected in the set of properties of the associatedServletRequest.- Specified by:
setPropertyin interfaceContainerRequestContext- Specified by:
setPropertyin interfacePropertiesDelegate- Parameters:
name- aStringspecifying the name of the property.object- anObjectrepresenting the property to be bound.
-
removeProperty
public void removeProperty(String name)
Description copied from interface:ContainerRequestContextRemoves a property with the given name from the current request/response exchange context. After removal, subsequent calls toContainerRequestContext.getProperty(java.lang.String)to retrieve the property value will returnnull.In a Servlet container, the properties are synchronized with the
ServletRequestand expose all the attributes available in theServletRequest. Any modifications of the properties are also reflected in the set of properties of the associatedServletRequest.- Specified by:
removePropertyin interfaceContainerRequestContext- Specified by:
removePropertyin interfacePropertiesDelegate- Parameters:
name- aStringspecifying the name of the property to be removed.
-
getPropertiesDelegate
public PropertiesDelegate getPropertiesDelegate()
Get the underlying properties delegate.- Returns:
- underlying properties delegate.
-
getUriInfo
public ExtendedUriInfo getUriInfo()
Description copied from interface:ContainerRequestContextGet request URI information. The returned object contains "live" view of the request URI information in a sense that any changes made to the request URI using one of thesetRequestUri(...)methods will be reflected in the previously returnedUriInfoinstance.- Specified by:
getUriInfoin interfaceContainerRequestContext- Returns:
- request URI information.
-
getReaderInterceptors
protected Iterable<ReaderInterceptor> getReaderInterceptors()
Get all reader interceptors applicable to this request. This is populated once the right resource method is matched.- Specified by:
getReaderInterceptorsin classInboundMessageContext- Returns:
- All reader interceptors applicable to the matched inflector (or an empty collection if no inflector matched yet).
-
getBaseUri
public URI getBaseUri()
Get base request URI.- Returns:
- base request URI.
-
getRequestUri
public URI getRequestUri()
Get request URI.- Returns:
- request URI.
-
getAbsolutePath
public URI getAbsolutePath()
Get the absolute path of the request. This includes everything preceding the path (host, port etc), but excludes query parameters or fragment.- Returns:
- the absolute path of the request.
-
setRequestUri
public void setRequestUri(URI requestUri) throws IllegalStateException
Description copied from interface:ContainerRequestContextSet a new request URI using the current base URI of the application to resolve the application-specific request URI part.Note that the method is usable only in pre-matching filters, prior to the resource matching occurs. Trying to invoke the method in a filter bound to a resource method results in an
IllegalStateExceptionbeing thrown.- Specified by:
setRequestUriin interfaceContainerRequestContext- Parameters:
requestUri- new URI of the request.- Throws:
IllegalStateException- in case the method is not invoked from apre-matchingrequest filter.- See Also:
ContainerRequestContext.setRequestUri(java.net.URI, java.net.URI)
-
setRequestUri
public void setRequestUri(URI baseUri, URI requestUri) throws IllegalStateException
Description copied from interface:ContainerRequestContextSet a new request URI using a new base URI to resolve the application-specific request URI part.Note that the method is usable only in pre-matching filters, prior to the resource matching occurs. Trying to invoke the method in a filter bound to a resource method results in an
IllegalStateExceptionbeing thrown.- Specified by:
setRequestUriin interfaceContainerRequestContext- Parameters:
baseUri- base URI that will be used to resolve the application-specific part of the request URI.requestUri- new URI of the request.- Throws:
IllegalStateException- in case the method is not invoked from apre-matchingrequest filter.- See Also:
ContainerRequestContext.setRequestUri(java.net.URI)
-
getPath
public String getPath(boolean decode)
Get the path of the current request relative to the application root (base) URI as a string.- Parameters:
decode- controls whether sequences of escaped octets are decoded (true) or not (false).- Returns:
- relative request path.
-
getMethod
public String getMethod()
Description copied from interface:ContainerRequestContextGet the request method.- Specified by:
getMethodin interfaceContainerRequestContext- Specified by:
getMethodin interfaceRequest- Returns:
- the request method.
- See Also:
HttpMethod
-
setMethod
public void setMethod(String method) throws IllegalStateException
Description copied from interface:ContainerRequestContextSet the request method.Note that the method is usable only in pre-matching filters, prior to the resource matching occurs. Trying to invoke the method in a filter bound to a resource method results in an
IllegalStateExceptionbeing thrown.- Specified by:
setMethodin interfaceContainerRequestContext- Parameters:
method- new request method.- Throws:
IllegalStateException- in case the method is not invoked from apre-matchingrequest filter.- See Also:
HttpMethod
-
setMethodWithoutException
public void setMethodWithoutException(String method)
LikesetMethod(String)but does not throwIllegalStateExceptionif the method is invoked in other than pre-matching phase.- Parameters:
method- HTTP method.
-
getSecurityContext
public SecurityContext getSecurityContext()
Description copied from interface:ContainerRequestContextGet the injectable security context information for the current request. TheSecurityContext.getUserPrincipal()must returnnullif the current request has not been authenticated.- Specified by:
getSecurityContextin interfaceContainerRequestContext- Returns:
- injectable request security context information.
-
setSecurityContext
public void setSecurityContext(SecurityContext context)
Description copied from interface:ContainerRequestContextSet a new injectable security context information for the current request. TheSecurityContext.getUserPrincipal()must returnnullif the current request has not been authenticated.- Specified by:
setSecurityContextin interfaceContainerRequestContext- Parameters:
context- new injectable request security context information.
-
setEntityStream
public void setEntityStream(InputStream input)
Description copied from class:InboundMessageContextSet a new entity input stream.- Specified by:
setEntityStreamin interfaceContainerRequestContext- Overrides:
setEntityStreamin classInboundMessageContext- Parameters:
input- new entity input stream.
-
getRequest
public Request getRequest()
Description copied from interface:ContainerRequestContextGet the injectable request information.- Specified by:
getRequestin interfaceContainerRequestContext- Returns:
- injectable request information.
-
abortWith
public void abortWith(Response response)
Description copied from interface:ContainerRequestContextAbort the filter chain with a response. This method breaks the filter chain processing and returns the provided response back to the client. The provided response goes through the chain of applicable response filters.- Specified by:
abortWithin interfaceContainerRequestContext- Parameters:
response- response to be sent back to the client.
-
inResponseProcessing
public void inResponseProcessing()
Notify this request that the response created from this request is already being processed. This means that the request processing phase has finished and this request can be used only in the request processing phase (for example in ContainerResponseFilter). The request can be used for processing of more than one response (in async cases). Then this method should be called when the first response is created from this request. Multiple calls to this method has the same effect as calling the method only once.
-
getAbortResponse
public Response getAbortResponse()
Get the request filter chain aborting response if set, ornullotherwise.- Returns:
- request filter chain aborting response if set, or
nullotherwise.
-
getCookies
public Map<String,Cookie> getCookies()
Description copied from interface:ContainerRequestContextGet any cookies that accompanied the request.- Specified by:
getCookiesin interfaceContainerRequestContext- Specified by:
getCookiesin interfaceHttpHeaders- Returns:
- a read-only map of cookie name (String) to
Cookie.
-
getAcceptableMediaTypes
public List<MediaType> getAcceptableMediaTypes()
Description copied from interface:ContainerRequestContextGet a list of media types that are acceptable for the response.- Specified by:
getAcceptableMediaTypesin interfaceContainerRequestContext- 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:ContainerRequestContextGet a list of languages that are acceptable for the response.- Specified by:
getAcceptableLanguagesin interfaceContainerRequestContext- Specified by:
getAcceptableLanguagesin interfaceHttpHeaders- Returns:
- a read-only list of acceptable languages sorted according to their q-value, with highest preference first.
-
selectVariant
public Variant selectVariant(List<Variant> variants) throws IllegalArgumentException
Description copied from interface:RequestSelect the representation variant that best matches the request. Returnsnullin case there is no matching variant in the list.More explicit variants are chosen ahead of less explicit ones. A vary header is computed from the supplied list and automatically added to the response.
- Specified by:
selectVariantin interfaceRequest- Parameters:
variants- a list of Variant that describe all of the available representation variants.- Returns:
- the variant that best matches the request or
nullif there's no match. - Throws:
IllegalArgumentException- if variants is empty ornull.- See Also:
Variant.VariantListBuilder
-
getVaryValue
public String getVaryValue()
Get the value of HTTP Vary response header to be set in the response, ornullif no value is to be set.- Returns:
- value of HTTP Vary response header to be set in the response if available,
nullotherwise.
-
evaluatePreconditions
public Response.ResponseBuilder evaluatePreconditions(EntityTag eTag)
Description copied from interface:RequestEvaluate request preconditions based on the passed in value.- Specified by:
evaluatePreconditionsin interfaceRequest- Parameters:
eTag- an ETag for the current state of the resource- Returns:
nullif the preconditions are met or aResponseBuilderset with the appropriate status if the preconditions are not met. A returnedResponseBuilderwill include an ETag header set with the value of eTag, provided none of the precondition evaluation has failed, in which case the ETag header would not be included and the status code of the returnedResponseBuilderwould be set toResponse.Status.PRECONDITION_FAILED.
-
evaluatePreconditions
public Response.ResponseBuilder evaluatePreconditions(Date lastModified)
Description copied from interface:RequestEvaluate request preconditions based on the passed in value.- Specified by:
evaluatePreconditionsin interfaceRequest- Parameters:
lastModified- a date that specifies the modification date of the resource- Returns:
nullif the preconditions are met or aResponseBuilderset with the appropriate status if the preconditions are not met.
-
evaluatePreconditions
public Response.ResponseBuilder evaluatePreconditions(Date lastModified, EntityTag eTag)
Description copied from interface:RequestEvaluate request preconditions based on the passed in value.- Specified by:
evaluatePreconditionsin interfaceRequest- Parameters:
lastModified- a date that specifies the modification date of the resourceeTag- an ETag for the current state of the resource- Returns:
nullif the preconditions are met or aResponseBuilderset with the appropriate status if the preconditions are not met. A returnedResponseBuilderwill include an ETag header set with the value of eTag, provided none of the precondition evaluation has failed, in which case the ETag header would not be included and the status code of the returnedResponseBuilderwould be set toResponse.Status.PRECONDITION_FAILED.
-
evaluatePreconditions
public Response.ResponseBuilder evaluatePreconditions()
Description copied from interface:RequestEvaluate request preconditions for a resource that does not currently exist. The primary use of this method is to support the If-Match: * and If-None-Match: * preconditions.Note that precondition
If-None-Match: somethingwill never be considered to have been met, and it is the application's responsibility to enforce any additional method-specific semantics. E.g. aPUTon a resource that does not exist might succeed whereas aGETon a resource that does not exist would likely result in a 404 response. It would be the responsibility of the application to generate the 404 response.- Specified by:
evaluatePreconditionsin interfaceRequest- Returns:
nullif the preconditions are met or aResponseBuilderset with the appropriate status if the preconditions are not met.
-
getRequestHeader
public List<String> getRequestHeader(String name)
Get the values of an 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. - Throws:
IllegalStateException- if called outside the scope of a request.
-
getRequestHeaders
public 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.- Specified by:
getRequestHeadersin interfaceHttpHeaders- Returns:
- a read-only map of header names and values.
- Throws:
IllegalStateException- if called outside the scope of a request.
-
-