public class GenericPipeline extends Object implements Pipeline, ValveContext
Pipeline.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
environment |
protected String |
name
Name of this pipeline.
|
protected ThreadLocal<Integer> |
state
The per-thread execution state for processing through this
pipeline.
|
| Constructor and Description |
|---|
GenericPipeline() |
| Modifier and Type | Method and Description |
|---|---|
void |
addValve(int position,
Valve valve) |
void |
addValve(Valve valve)
Add a new Valve to the end of the pipeline.
|
Map<String,Object> |
getEnvironment()
Retrieve the environment of the pipeline, this is usually useful inside
valve implementation to retrieve the environment of the pipeline, and for
example access service instance, etc...
|
Valve |
getFirstValveOfClass(Class<Valve> c)
Return the first valve of the pipeline that is an instance
of a given class or interface.
|
String |
getName()
Get the name of this pipeline.
|
Valve[] |
getValves()
Return the set of all Valves in the pipeline.
|
boolean |
hasValveOfClass(Class<Valve> c)
Tell if (at least) one of the valves of the pipeline is an instance
of a given class or interface.
|
int |
indexOf(Valve valve) |
void |
initialize() |
void |
invoke(Object context)
Cause the specified request and response to be processed by
the sequence of Valves associated with this pipeline, until one
of these Valves decides to end the processing.
|
void |
invokeNext(Object context)
Cause the
invoke() method of the next Valve
that is part of the Pipeline currently being processed (if any)
to be executed, passing on the specified request and response
objects plus this ValveContext instance. |
void |
removeValve(Valve valve)
Remove the specified Valve from the pipeline, if it is found;
otherwise, do nothing.
|
void |
setEnvironment(Map<String,Object> environment)
Used by users of the pipeline to provide an environment in which the valves
will execute.
|
void |
setName(String name)
Set the name of this pipeline.
|
void |
setValves(Valve[] valves) |
protected String name
protected ThreadLocal<Integer> state
values array, or
a subscript equal to values.length if the basic
Valve is currently being processed.public Map<String,Object> getEnvironment()
ValveContextgetEnvironment in interface ValveContextpublic void setEnvironment(Map<String,Object> environment)
PipelinesetEnvironment in interface Pipelinepublic void initialize()
throws PipelineException
initialize in interface PipelinePipelineExceptionpublic void setName(String name)
name - Name of this pipeline.public String getName()
public Valve[] getValves()
PipelineReturn the set of all Valves in the pipeline. If there are no such Valves, a zero-length array is returned.
public void setValves(Valve[] valves)
public void addValve(Valve valve)
PipelineAdd a new Valve to the end of the pipeline.
public void addValve(int position,
Valve valve)
public void removeValve(Valve valve)
PipelineRemove the specified Valve from the pipeline, if it is found; otherwise, do nothing.
removeValve in interface Pipelinevalve - Valve to be removed.public void invoke(Object context) throws PipelineException
PipelineCause the specified request and response to be processed by the sequence of Valves associated with this pipeline, until one of these Valves decides to end the processing.
The implementation must ensure that multiple simultaneous requests (on different threads) can be processed through the same Pipeline without interfering with each other's control flow.
invoke in interface Pipelinecontext - The run-time information, including the servlet
request and response we are processing.PipelineException - an input/output error occurred.public void invokeNext(Object context) throws PipelineException
ValveContextCause the invoke() method of the next Valve
that is part of the Pipeline currently being processed (if any)
to be executed, passing on the specified request and response
objects plus this ValveContext instance.
Exceptions thrown by a subsequently executed Valve will be
passed on to our caller.
If there are no more Valves to be executed, execution of this method will result in a no op.
invokeNext in interface ValveContextcontext - The run-time information, including the servlet
request and response we are processing.PipelineException - Thrown by a subsequent Valve.public boolean hasValveOfClass(Class<Valve> c)
PipelineTell if (at least) one of the valves of the pipeline is an instance of a given class or interface.
hasValveOfClass in interface Pipelinec - the class or interfacePipeline.hasValveOfClass(java.lang.Class)public Valve getFirstValveOfClass(Class<Valve> c)
PipelineReturn the first valve of the pipeline that is an instance of a given class or interface.
getFirstValveOfClass in interface Pipelinec - the class or interfacePipeline.getFirstValveOfClass(java.lang.Class)public int indexOf(Valve valve)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.