public interface ContainerRequestContext
Modifier and Type | Method and Description |
---|---|
void |
abortWith(Response response)
Abort the filter chain with a response.
|
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.
|
Date |
getDate()
Get message date.
|
InputStream |
getEntityStream()
Get the entity input stream.
|
MultivaluedMap<String,String> |
getHeaders()
Get the mutable request headers multivalued map.
|
String |
getHeaderString(String name)
Get a message header as a single string value.
|
Locale |
getLanguage()
Get the language of the entity.
|
int |
getLength()
Get Content-Length value.
|
MediaType |
getMediaType()
Get the media type of the entity.
|
String |
getMethod()
Get the request method.
|
Object |
getProperty(String name)
Returns the property with the given name registered in the current request/response
exchange context, or
null if there is no property by that name. |
Collection<String> |
getPropertyNames()
Returns an immutable
collection containing the property
names available within the context of the current request/response exchange context. |
Request |
getRequest()
Get the injectable request information.
|
SecurityContext |
getSecurityContext()
Get the injectable security context information for the current request.
|
UriInfo |
getUriInfo()
Get request URI information.
|
boolean |
hasEntity()
Check if there is a non-empty entity input stream available in the request
message.
|
void |
removeProperty(String name)
Removes a property with the given name from the current request/response
exchange context.
|
void |
setEntityStream(InputStream input)
Set a new entity input stream.
|
void |
setMethod(String method)
Set the request method.
|
void |
setProperty(String name,
Object object)
Binds an object to a given property name in the current request/response
exchange context.
|
void |
setRequestUri(URI requestUri)
Set a new request URI using the current base URI of the application to
resolve the application-specific request URI part.
|
void |
setRequestUri(URI baseUri,
URI requestUri)
Set a new request URI using a new base URI to resolve the application-specific
request URI part.
|
void |
setSecurityContext(SecurityContext context)
Set a new injectable security context information for the current request.
|
Object getProperty(String name)
null
if 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 getPropertyNames()
.
Custom property names should follow the same convention as package names.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest
. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest
.
name
- a String
specifying the name of the property.Object
containing the value of the property, or
null
if no property exists matching the given name.getPropertyNames()
Collection<String> getPropertyNames()
collection
containing the property
names available within the context of the current request/response exchange context.
Use the 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 ServletRequest
and expose all the attributes available in the ServletRequest
. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest
.
collection
of property names.getProperty(java.lang.String)
void setProperty(String name, Object object)
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 getPropertyNames()
.
Custom property names should follow the same convention as package names.
If a null
value is passed, the effect is the same as calling the
removeProperty(String)
method.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest
. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest
.
name
- a String
specifying the name of the property.object
- an Object
representing the property to be bound.void removeProperty(String name)
getProperty(java.lang.String)
to retrieve the property value will return null
.
In a Servlet container, the properties are synchronized with the ServletRequest
and expose all the attributes available in the ServletRequest
. Any modifications
of the properties are also reflected in the set of properties of the associated
ServletRequest
.
name
- a String
specifying the name of the property to be removed.UriInfo getUriInfo()
setRequestUri(...)
methods will be reflected in the previously
returned UriInfo
instance.void setRequestUri(URI requestUri)
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 IllegalStateException
being thrown.
requestUri
- new URI of the request.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.setRequestUri(java.net.URI, java.net.URI)
void setRequestUri(URI baseUri, URI requestUri)
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 IllegalStateException
being thrown.
baseUri
- base URI that will be used to resolve the application-specific
part of the request URI.requestUri
- new URI of the request.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.setRequestUri(java.net.URI)
Request getRequest()
String getMethod()
HttpMethod
void setMethod(String 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 IllegalStateException
being thrown.
method
- new request method.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.HttpMethod
MultivaluedMap<String,String> getHeaders()
getHeaderString(String)
String getHeaderString(String name)
name
- the message header.null
is returned. If the message header is present but has no
value then the empty string is returned. If the message header is present
more than once then the values of joined together and separated by a ','
character.getHeaders()
Date getDate()
null
if not present.Locale getLanguage()
null
if not specifiedint getLength()
-1
.MediaType getMediaType()
null
if not specified (e.g. there's no
request entity).List<MediaType> getAcceptableMediaTypes()
List<Locale> getAcceptableLanguages()
Map<String,Cookie> getCookies()
Cookie
.boolean hasEntity()
true
if the entity is present, returns
false
otherwise.true
if there is an entity present in the message,
false
otherwise.InputStream getEntityStream()
void setEntityStream(InputStream input)
input
- new entity input stream.IllegalStateException
- in case the method is invoked from a response filter.SecurityContext getSecurityContext()
SecurityContext.getUserPrincipal()
must return null
if the current request has not been authenticated.void setSecurityContext(SecurityContext context)
SecurityContext.getUserPrincipal()
must return null
if the current request has not been authenticated.context
- new injectable request security context information.IllegalStateException
- in case the method is invoked from a response filter.void abortWith(Response response)
response
- response to be sent back to the client.IllegalStateException
- in case the method is invoked from a response filter.Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.