@Provider @PreMatching public final class RequestContextFilter extends Object implements ContainerRequestFilter, ContainerResponseFilter
Constructor and Description |
---|
RequestContextFilter(org.glassfish.hk2.api.ServiceLocator locator)
Create a new request context filter instance.
|
Modifier and Type | Method and Description |
---|---|
void |
filter(ContainerRequestContext requestContext)
Filter method called before a request has been dispatched to a resource.
|
void |
filter(ContainerRequestContext requestContext,
ContainerResponseContext responseContext)
Filter method called after a response has been provided for a request
(either by a
request filter or by a
matched resource method. |
@Inject public RequestContextFilter(org.glassfish.hk2.api.ServiceLocator locator)
locator
- HK2 service locator.public void filter(ContainerRequestContext requestContext) throws IOException
ContainerRequestFilter
Filters in the filter chain are ordered according to their javax.annotation.Priority
class-level annotation value.
If a request filter produces a response by calling ContainerRequestContext.abortWith(javax.ws.rs.core.Response)
method, the execution of the (either pre-match or post-match) request filter
chain is stopped and the response is passed to the corresponding response
filter chain (either pre-match or post-match). For example, a pre-match
caching filter may produce a response in this way, which would effectively
skip any post-match request filters as well as post-match response filters.
Note however that a responses produced in this manner would still be processed
by the pre-match response filter chain.
filter
in interface ContainerRequestFilter
requestContext
- request context.IOException
- if an I/O exception occurs.PreMatching
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException
ContainerResponseFilter
request filter
or by a
matched resource method.
Filters in the filter chain are ordered according to their javax.annotation.Priority
class-level annotation value.
filter
in interface ContainerResponseFilter
requestContext
- request context.responseContext
- response context.IOException
- if an I/O exception occurs.Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.