|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ContainerRequestContext
Container request filter context. A mutable class that provides request-specific information for the filter, such as request URI, message headers, message entity or request-scoped properties. The exposed setters allow modification of the exposed request-specific information.
Method Summary | |
---|---|
void |
abortWith(Response response)
Abort the filter chain with a response. |
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.Date |
getDate()
Get message date. |
java.io.InputStream |
getEntityStream()
Get the entity input stream. |
MultivaluedMap<java.lang.String,java.lang.String> |
getHeaders()
Get the mutable request headers multivalued map. |
java.lang.String |
getHeaderString(java.lang.String name)
Get a message header as a single string value. |
java.util.Locale |
getLanguage()
Get the language of the entity. |
int |
getLength()
Get Content-Length value. |
MediaType |
getMediaType()
Get the media type of the entity. |
java.lang.String |
getMethod()
Get the request method. |
java.lang.Object |
getProperty(java.lang.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. |
java.util.Enumeration<java.lang.String> |
getPropertyNames()
Returns an enumeration 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(java.lang.String name)
Removes a property with the given name from the current request/response exchange context. |
void |
setEntityStream(java.io.InputStream input)
Set a new entity input stream. |
void |
setMethod(java.lang.String method)
Set the request method. |
void |
setProperty(java.lang.String name,
java.lang.Object object)
Binds an object to a given property name in the current request/response exchange context. |
void |
setRequestUri(java.net.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(java.net.URI baseUri,
java.net.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. |
Method Detail |
---|
java.lang.Object getProperty(java.lang.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 backed by the ServletRequest
and
contain all the attributes available in the 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()
java.util.Enumeration<java.lang.String> getPropertyNames()
enumeration
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 backed by the ServletRequest
and
contain all the attributes available in the ServletRequest
.
enumeration
of property names.getProperty(java.lang.String)
void setProperty(java.lang.String name, java.lang.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 backed by the ServletRequest
and
contain all the attributes available in the ServletRequest
.
name
- a String
specifying the name of the property.object
- an Object
representing the property to be bound.void removeProperty(java.lang.String name)
getProperty(java.lang.String)
to retrieve the property value will return null
.
In a Servlet container, the properties are backed by the ServletRequest
and
contain all the attributes available in the 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(java.net.URI requestUri) throws java.lang.IllegalStateException
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.
java.lang.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.setRequestUri(java.net.URI, java.net.URI)
void setRequestUri(java.net.URI baseUri, java.net.URI requestUri) throws java.lang.IllegalStateException
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.
java.lang.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.setRequestUri(java.net.URI)
Request getRequest()
java.lang.String getMethod()
HttpMethod
void setMethod(java.lang.String method) throws java.lang.IllegalStateException
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.
java.lang.IllegalStateException
- in case the method is not invoked from a pre-matching
request filter.HttpMethod
MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
getHeaderString(String)
java.lang.String getHeaderString(java.lang.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()
java.util.Date getDate()
null
if not present.java.util.Locale getLanguage()
null
if not specifiedint getLength()
-1
.MediaType getMediaType()
null
if not specified (e.g. there's no
request entity).java.util.List<MediaType> getAcceptableMediaTypes()
java.util.List<java.util.Locale> getAcceptableLanguages()
java.util.Map<java.lang.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.java.io.InputStream getEntityStream()
void setEntityStream(java.io.InputStream input) throws java.lang.IllegalStateException
input
- new entity input stream.
java.lang.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) throws java.lang.IllegalStateException
SecurityContext.getUserPrincipal()
must return null
if the current request has not been authenticated.
context
- new injectable request security context information.
java.lang.IllegalStateException
- in case the method is invoked from a response filter.void abortWith(Response response) throws java.lang.IllegalStateException
response
- response to be sent back to the client.
java.lang.IllegalStateException
- in case the method is invoked from a response filter.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |