I put together an implementation of some of the ideas I discussed earlier, in the form of and abstract BaseConditionValve and two concrete subclasses (request and extension based) that allow a set of valves to be included or excluded based on conditions (implementation defined). The mapper made this very easy!
The condition valve essentially wraps a pipeline. When invoked it runs
the doTest method (which subclasses must implement) and if that returns
true in invokes the set of valves it contains, before invokeing its next
sibling.
An implementation that emulates a switch rather than an if should be
easy to put together along the same lines.
I changed the 'classic' pipeline to support vm and jsp, and added a test
to the TurbineSerlvetTest that tests the jsp page Index.jsp, everything
works great. The pipeline config now looks like this:
<pipeline>
<name>TurbineClassicPipeline</name>
<valves>
<valve className="org.apache.turbine.pipeline.DetermineActionValve"/>
<valve className="org.apache.turbine.pipeline.DetermineTargetValve"/>
<valve className="org.apache.turbine.pipeline.DefaultSessionTimeoutValve"/>
<valve className="org.apache.turbine.pipeline.DefaultLoginValve"/>
<valve className="org.apache.turbine.pipeline.DefaultSessionValidationValve"/>
<valve className="org.apache.turbine.pipeline.DefaultACLCreationValve"/>
<valve className="org.apache.turbine.pipeline.DefaultActionValve"/>
<valve className="org.apache.turbine.pipeline.RunModulesValve"/>
<valve className="org.apache.turbine.pipeline.TargetExtensionConditionalValve">
<extension>.vm</extension>
<valves>
<valve className="org.apache.turbine.pipeline.DefaultTargetValve"/>
</valves>
</valve>
<valve className="org.apache.turbine.pipeline.TargetExtensionConditionalValve">
<extension>.jsp</extension>
<valves>
<valve className="org.apache.turbine.pipeline.JspRendererValve"/>
</valves>
</valve>
</valves>
</pipeline>
I'm really happy with the way this turned out. It seems pretty elegant
considering no changes to existing pipeline classes were required.
Thoughts?
Thanks,
James
conditional-valve-changes.tar.gz
Description: GNU Zip compressed data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
