Class TurbinePipeline
- java.lang.Object
-
- org.apache.turbine.pipeline.TurbinePipeline
-
- All Implemented Interfaces:
Pipeline
,ValveContext
public class TurbinePipeline extends Object implements Pipeline, ValveContext
Flexible implementation of aPipeline
. Originally based on code from Catalina and ideas from Apache httpd.- Author:
- Daniel Rall, Jason van Zyl, Peter Courcoux
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLASSIC_PIPELINE
The "Turbine Classic" pipeline.
-
Constructor Summary
Constructors Constructor Description TurbinePipeline()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValve(Valve valve)
Add a new Valve to the end of the pipeline.String
getName()
Get the name of this pipeline.Valve[]
getValves()
Return the set of all Valves in the pipeline.void
initialize()
Initializes this instance.void
invoke(PipelineData pipelineData)
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(PipelineData pipelineData)
Cause theinvoke()
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 thisValveContext
instance.void
removeValve(Valve valve)
Remove the specified Valve from the pipeline, if it is found; otherwise, do nothing.void
setName(String name)
Set the name of this pipeline.protected void
setValves(Valve[] valves)
Set new valves during deserialization
-
-
-
Field Detail
-
CLASSIC_PIPELINE
public static final String CLASSIC_PIPELINE
The "Turbine Classic" pipeline.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TurbinePipeline
public TurbinePipeline()
-
-
Method Detail
-
initialize
public void initialize() throws Exception
Description copied from interface:Pipeline
Initializes this instance. Called once by the Turbine servlet.- Specified by:
initialize
in interfacePipeline
- Throws:
Exception
- if the initialization fails- See Also:
Pipeline.initialize()
-
setName
public void setName(String name)
Set the name of this pipeline.- Parameters:
name
- Name of this pipeline.
-
getName
public String getName()
Get the name of this pipeline.- Returns:
- String Name of this pipeline.
-
addValve
public void addValve(Valve valve)
Description copied from interface:Pipeline
Add a new Valve to the end of the pipeline.
- Specified by:
addValve
in interfacePipeline
- Parameters:
valve
- Valve to be added.- See Also:
Pipeline.addValve(Valve)
-
getValves
public Valve[] getValves()
Description copied from interface:Pipeline
Return the set of all Valves in the pipeline. If there are no such Valves, a zero-length array is returned.- Specified by:
getValves
in interfacePipeline
- Returns:
- An array of valves.
- See Also:
Pipeline.getValves()
-
setValves
protected void setValves(Valve[] valves)
Set new valves during deserialization- Parameters:
valves
- the valves to set
-
removeValve
public void removeValve(Valve valve)
Description copied from interface:Pipeline
Remove the specified Valve from the pipeline, if it is found; otherwise, do nothing.- Specified by:
removeValve
in interfacePipeline
- Parameters:
valve
- Valve to be removed.- See Also:
Pipeline.removeValve(Valve)
-
invoke
public void invoke(PipelineData pipelineData) throws TurbineException, IOException
Description copied from interface:Pipeline
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.
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.
- Specified by:
invoke
in interfacePipeline
- Parameters:
pipelineData
- The run-time information, including the servlet request and response we are processing.- Throws:
TurbineException
- if the invocation failsIOException
- an input/output error occurred.- See Also:
Pipeline.invoke(PipelineData)
-
invokeNext
public void invokeNext(PipelineData pipelineData) throws TurbineException, IOException
Description copied from interface:ValveContext
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 thisValveContext
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.
- Specified by:
invokeNext
in interfaceValveContext
- Parameters:
pipelineData
- The run-time information, including the servlet request and response we are processing.- Throws:
TurbineException
- Thrown by a subsequent Valve.IOException
- Thrown by a subsequent Valve.- See Also:
ValveContext.invokeNext(PipelineData)
-
-