org.glassfish.jersey.process.internal
Class FilteringAcceptor

java.lang.Object
  extended by org.glassfish.jersey.process.internal.AbstractChainableAcceptor
      extended by org.glassfish.jersey.process.internal.FilteringAcceptor
All Implemented Interfaces:
ChainableAcceptor, LinearAcceptor

public class FilteringAcceptor
extends AbstractChainableAcceptor

Filtering chainable acceptor that runs request filter processor on a request and registers response filter processor to be run on a response.

The acceptor may break the chain by directly returning a response in case any of the executed request filters sets a response in the filter context.

Author:
Pavel Bucek (pavel.bucek at oracle.com), Santiago Pericas-Geertsen (santiago.pericasgeertsen at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.jersey.process.internal.LinearAcceptor
LinearAcceptor.Builder
 
Constructor Summary
FilteringAcceptor(RequestFilterProcessor requestFilterProcessor, ResponseFilterProcessor responseFilterProcessor, org.glassfish.hk2.Factory<org.glassfish.jersey.process.internal.JerseyFilterContext> filterContextFactory, org.glassfish.hk2.Factory<ResponseProcessor.RespondingContext> respondingContextFactory)
          Create a new filtering acceptor.
 
Method Summary
 Pair<Request,com.google.common.base.Optional<LinearAcceptor>> apply(Request request)
          Transforms supplied data and returns transformed data together with a processing continuation in the form of a <data, continuation> pair.
 
Methods inherited from class org.glassfish.jersey.process.internal.AbstractChainableAcceptor
getDefaultNext, setDefaultNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteringAcceptor

public FilteringAcceptor(RequestFilterProcessor requestFilterProcessor,
                         ResponseFilterProcessor responseFilterProcessor,
                         org.glassfish.hk2.Factory<org.glassfish.jersey.process.internal.JerseyFilterContext> filterContextFactory,
                         org.glassfish.hk2.Factory<ResponseProcessor.RespondingContext> respondingContextFactory)
Create a new filtering acceptor.

Parameters:
requestFilterProcessor - request filter processor to be executed on requests.
responseFilterProcessor - response filter processor to be executed on responses.
filterContextFactory - factory providing request-scoped filter contexts.
respondingContextFactory - factory providing request-scoped responding contexts.
Method Detail

apply

public Pair<Request,com.google.common.base.Optional<LinearAcceptor>> apply(Request request)
Description copied from interface: LinearAcceptor
Transforms supplied data and returns transformed data together with a processing continuation in the form of a <data, continuation> pair.

The returned continuation is (optionally) the next linear acceptor that should be invoked. A present continuation indicates the processing is expected to continue further, while absence of a continuation indicates that the unidirectional request transformation passed its final stage.

Parameters:
request - data to be transformed.
Returns:
a pair of transformed data and processing continuation; the transformed data is on the left and the processing continuation on the right side of the pair.


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