org.glassfish.jersey.process.internal
Class HierarchicalRequestProcessor

java.lang.Object
  extended by org.glassfish.jersey.process.internal.HierarchicalRequestProcessor
All Implemented Interfaces:
com.google.common.base.Function<javax.ws.rs.core.Request,Pair<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>>>, RequestProcessor, Stage<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>>

public class HierarchicalRequestProcessor
extends Object
implements RequestProcessor

A composite hierarchical request processor.

When invoked, the supplied request is continuously transformed by the nested stage hierarchy using a depth-first transformation strategy until a request-to-response inflector is found on a leaf stage node, in which case the hierarchical stage transformation is terminated and a continuation with the transformed request on the left side and the inflector on the right side is returned.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.jersey.process.internal.Stage
Stage.Root
 
Constructor Summary
HierarchicalRequestProcessor(TreeAcceptor rootStage, org.glassfish.hk2.Factory<StagingContext<javax.ws.rs.core.Request>> contextProvider)
          Construct a hierarchical request processor.
 
Method Summary
 Pair<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>> apply(javax.ws.rs.core.Request request)
          Traverse through the nested request stages and apply request transformations until a terminal stage providing a request-to-response inflector is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Constructor Detail

HierarchicalRequestProcessor

public HierarchicalRequestProcessor(@Stage.Root
                                    TreeAcceptor rootStage,
                                    org.glassfish.hk2.Factory<StagingContext<javax.ws.rs.core.Request>> contextProvider)
Construct a hierarchical request processor.

Parameters:
rootStage - head of the nested stage hierarchy to be applied.
contextProvider - staging context to be invoked before and after each stage is applied.
Method Detail

apply

public Pair<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>> apply(javax.ws.rs.core.Request request)
Traverse through the nested request stages and apply request transformations until a terminal stage providing a request-to-response inflector is reached. If the terminal stage does not provide an inflector, the inflector returned on the right side of the continuation will be absent.

This implementation applies the nested stage hierarchy using a depth-first transformation strategy until a request-to-response inflector is found on a leaf stage node, in which case the hierarchical stage transformation is terminated and a continuation with the transformed request on the left side and the inflector on the right side is returned.

Specified by:
apply in interface com.google.common.base.Function<javax.ws.rs.core.Request,Pair<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>>>
Specified by:
apply in interface RequestProcessor
Specified by:
apply in interface Stage<javax.ws.rs.core.Request,com.google.common.base.Optional<Inflector<javax.ws.rs.core.Request,javax.ws.rs.core.Response>>>
Parameters:
request - request data to be transformed
Returns:
continuation with the transformed request on the left side and the (optional) request-to-response inflector on the right side.


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