javax.ws.rs.container
Interface ContainerResponseFilter


public interface ContainerResponseFilter

An extension interface implemented by container response filters. By default, i.e. if no name binding is applied to the filter implementation class, the filter(...) method is called globally for all responses, i.e. even in case an actual resource matching failed or has not been performed at all. If there is a @NameBinding annotation applied to the filter, the filter will be executed only for responses created for requests that were successfully matched to a resource method.

Implement a name-bound response filter in cases when you want limit the filter functionality to a particular resource or resource method or if you depend on a matched resource information in your filter processing. In other cases, when the filter should be applied globally to all responses, even in those cases when a request has not been matched to a resource implement an unbound response filter.

Filters implementing this interface must be annotated with @Provider to be discovered by the JAX-RS runtime. Container response filter instances may also be discovered and bound dynamically to particular resource methods.

Since:
2.0
Author:
Marek Potociar, Santiago Pericas-Geertsen
See Also:
PostMatching, ContainerRequestFilter

Method Summary
 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.
 

Method Detail

filter

void filter(ContainerRequestContext requestContext,
            ContainerResponseContext responseContext)
            throws java.io.IOException
Filter method called after a response has been provided for a request (either by a request filter or by a matched resource method. By default, i.e. if no name binding is applied to the filter implementation class, the filter(...) method is called globally for all responses, i.e. even in case an actual resource matching failed or has not been performed at all. If there is a @NameBinding annotation applied to the filter, the filter will be executed only for responses created for requests that were successfully matched to a resource method.

Filters in the filter chain are ordered according to their binding priority (see BindingPriority).

Parameters:
requestContext - request context.
responseContext - response context.
Throws:
java.io.IOException - if an I/O exception occurs.
See Also:
PostMatching


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.