Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.core
Class StandardPipeline

    java.lang.Object
      |
      +--org.apache.catalina.core.StandardPipeline

All Implemented Interfaces:
  Contained, Lifecycle, Pipeline, ValveContext

public class StandardPipeline
extends java.lang.Object
implements Pipeline, Contained, Lifecycle, ValveContext

Standard implementation of a processing Pipeline that will invoke a series of Valves that have been configured to be called in order. This implementation can be used for any type of Container. IMPLEMENTATION WARNING - This implementation assumes that no calls to `addValve()` or `removeValve` are allowed while a request is currently being processed. Otherwise, the mechanism by which per-thread state is maintained will need to be modified.

Author:
  Craig R. McClanahan

Field Summary
`protected Valve` | `basic` The basic Valve (if any) associated with this Pipeline.
`protected Container` | `container` The Container with which this Pipeline is associated.
`protected int` | `debug` The debugging detail level for this component.
`protected java.lang.String` | `info` Descriptive information about this implementation.
`protected LifecycleSupport` | `lifecycle` The lifecycle event support for this component.
`protected static StringManager` | `sm` The string manager for this package.
`protected boolean` | `started` Has this component been started yet?
`protected java.lang.ThreadLocal` | `state` The per-thread execution state for processing through this pipeline.
`protected Valve[]` | `valves` The set of Valves (not including the Basic one, if any) associated with this Pipeline.

Fields inherited from interface org.apache.catalina.Lifecycle
`START_EVENT, STOP_EVENT`

Constructor Summary
`StandardPipeline()` Construct a new StandardPipeline instance with no associated Container.
`StandardPipeline(Container container)` Construct a new StandardPipeline instance that is associated with the specified Container.

Method Summary
`void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`void` | `addValve(Valve valve)` Add a new Valve to the end of the pipeline associated with this Container.
`Valve` | `getBasic()` Return the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).
`Container` | `getContainer()` Return the Container with which this Pipeline is associated.
`java.lang.String` | `getInfo()` Return descriptive information about this implementation class.
`Valve[]` | `getValves()` Return the set of Valves in the pipeline associated with this Container, including the basic Valve (if any).
`void` | `invoke(Request request, Response response)` Cause the specified request and response to be processed by the Valves associated with this pipeline, until one of these valves causes the response to be created and returned.
`void` | `invokeNext(Request request, Response response)` 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.
`protected void` | `log(java.lang.String message)` Log a message on the Logger associated with our Container (if any).
`protected void` | `log(java.lang.String message, java.lang.Throwable throwable)` Log a message on the Logger associated with our Container (if any).
`void` | `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` | `removeValve(Valve valve)` Remove the specified Valve from the pipeline associated with this Container, if it is found; otherwise, do nothing.
`void` | `setBasic(Valve valve)` Set the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).
`void` | `setContainer(Container container)` Set the Container with which this Pipeline is associated.
`void` | `start()` Prepare for active use of the public methods of this Component.
`void` | `stop()` Gracefully shut down active use of the public methods of this Component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### basic

    protected Valve basic

  The basic Valve (if any) associated with this Pipeline.

### container

    protected Container container

  The Container with which this Pipeline is associated.

### debug

    protected int debug

  The debugging detail level for this component.

### info

    protected java.lang.String info

  Descriptive information about this implementation.

### lifecycle

    protected LifecycleSupport lifecycle

  The lifecycle event support for this component.

### sm

    protected static StringManager sm

  The string manager for this package.

### started

    protected boolean started

  Has this component been started yet?

### state

    protected java.lang.ThreadLocal state

  The per-thread execution state for processing through this pipeline. The actual value is a java.lang.Integer object containing the subscript into the `values` array, or a subscript equal to `values.length` if the basic Valve is currently being processed.

### valves

    protected Valve[] valves

  The set of Valves (not including the Basic one, if any) associated with this Pipeline.

Constructor Detail

### StandardPipeline

    public StandardPipeline()

  Construct a new StandardPipeline instance with no associated Container.

### StandardPipeline

    public StandardPipeline(Container container)

  Construct a new StandardPipeline instance that is associated with the specified Container.

Parameters:
  `container` - The container we should be associated with

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this implementation class.

  Specified by:
    `getInfo` in interface `ValveContext`

### getContainer

    public Container getContainer()

  Return the Container with which this Pipeline is associated.

  Specified by:
    `getContainer` in interface `Contained`

### setContainer

    public void setContainer(Container container)

  Set the Container with which this Pipeline is associated.

  Specified by:
    `setContainer` in interface `Contained`
  Parameters:
    `container` - The new associated container

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.

  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.

  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to remove

### start

    public void start()
               throws LifecycleException

  Prepare for active use of the public methods of this Component.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `java.lang.IllegalStateException` - if this component has already been started
    `LifecycleException` - if this component detects a fatal error that prevents it from being started

### stop

    public void stop()
              throws LifecycleException

  Gracefully shut down active use of the public methods of this Component.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `java.lang.IllegalStateException` - if this component has not been started
    `LifecycleException` - if this component detects a fatal error that needs to be reported

### getBasic

    public Valve getBasic()

  Return the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).

  Specified by:
    `getBasic` in interface `Pipeline`

### setBasic

    public void setBasic(Valve valve)

  Set the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any). Prioer to setting the basic Valve, the Valve's `setContainer()` will be called, if it implements `Contained`, with the owning Container as an argument. The method may throw an `IllegalArgumentException` if this Valve chooses not to be associated with this Container, or `IllegalStateException` if it is already associated with a different Container.

  Specified by:
    `setBasic` in interface `Pipeline`
  Parameters:
    `valve` - Valve to be distinguished as the basic Valve

### addValve

    public void addValve(Valve valve)

  Add a new Valve to the end of the pipeline associated with this Container. Prior to adding the Valve, the Valve's `setContainer()` method will be called, if it implements `Contained`, with the owning Container as an argument. The method may throw an `IllegalArgumentException` if this Valve chooses not to be associated with this Container, or `IllegalStateException` if it is already associated with a different Container.

  Specified by:
    `addValve` in interface `Pipeline`
  Parameters:
    `valve` - Valve to be added
  Throws:
    `java.lang.IllegalArgumentException` - if this Container refused to accept the specified Valve
    `java.lang.IllegalArgumentException` - if the specifie Valve refuses to be associated with this Container
    `java.lang.IllegalStateException` - if the specified Valve is already associated with a different Container

### getValves

    public Valve[] getValves()

  Return the set of Valves in the pipeline associated with this Container, including the basic Valve (if any). If there are no such Valves, a zero-length array is returned.

  Specified by:
    `getValves` in interface `Pipeline`

### invoke

    public void invoke(Request request,
                       Response response)
                throws java.io.IOException,
                       javax.servlet.ServletException

  Cause the specified request and response to be processed by the Valves associated with this pipeline, until one of these valves causes the response to be created and returned. 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 interface `Pipeline`
  Parameters:
    `request` - The servlet request we are processing
    `response` - The servlet response we are creating
  Throws:
    `java.io.IOException` - if an input/output error occurs
    `javax.servlet.ServletException` - if a servlet exception is thrown

### removeValve

    public void removeValve(Valve valve)

  Remove the specified Valve from the pipeline associated with this Container, if it is found; otherwise, do nothing. If the Valve is found and removed, the Valve's `setContainer(null)` method will be called if it implements `Contained`.

  Specified by:
    `removeValve` in interface `Pipeline`
  Parameters:
    `valve` - Valve to be removed

### invokeNext

    public void invokeNext(Request request,
                           Response response)
                    throws java.io.IOException,
                           javax.servlet.ServletException

  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. Exceptions thrown by a subsequently executed Valve (or a Filter or Servlet at the application level) will be passed on to our caller. If there are no more Valves to be executed, an appropriate ServletException will be thrown by this ValveContext.

  Specified by:
    `invokeNext` in interface `ValveContext`
  Parameters:
    `request` - The request currently being processed
    `response` - The response currently being created
  Throws:
    `java.io.IOException` - if thrown by a subsequent Valve, Filter, or Servlet
    `javax.servlet.ServletException` - if thrown by a subsequent Valve, Filter, or Servlet
    `javax.servlet.ServletException` - if there are no further Valves configured in the Pipeline currently being processed

### log

    protected void log(java.lang.String message)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged

### log

    protected void log(java.lang.String message,
                       java.lang.Throwable throwable)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged
    `throwable` - Associated exception

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.