Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added scrollbar at top & bottom, fixed broken links
Wiki Markup
{scrollbar}

Building Pipelines

A common pattern within Tapestry is the use of filtering pipelines. Another name for a pipeline is a filter chain; an example of this is the Filter and FilterChain interfaces inside the Servlet API.

In this pattern, an existing service is decorated with a filter. The filter will delegate to the service, but has the chance to alter or replace parameters before invoking the method, and can perform operations before returning. This is similar to chain of command, but differs in that there are two interfaces (the service interface and the filter interface) and that each filter invokes the next filter via the service interface. In chain of command, the chain invokes each method, which must return before the next command in the chain is invoked.

...

Here, we create the terminator for the pipeline as an inner class instance, and feed that into the builder. The result is a new service that encapsulates the entire pipeline. When there are no filters, this is just the terminator.

Wiki Markup
{scrollbar}