org.apache.catalina.core

## Class StandardPipeline

- java.lang.Object
- - org.apache.catalina.util.LifecycleBase
  - - org.apache.catalina.core.StandardPipeline

All Implemented Interfaces:
  Contained, Lifecycle, Pipeline

    public class StandardPipeline
    extends LifecycleBase
    implements Pipeline, Contained

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

Fields
`protected Valve` `basic` The basic Valve (if any) associated with this Pipeline.
`protected Container` `container` The Container with which this Pipeline is associated.
`protected Valve` `first` The first valve associated with this Pipeline.
`protected static String` `info` Descriptive information about this implementation.

### Fields inherited from interface org.apache.catalina.Lifecycle

`AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

### Constructor Summary

Constructors
Constructor and Description
`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

Methods
`void` `addValve(Valve valve)` Add a new Valve to the end of the pipeline associated with this Container.
`protected void` `destroyInternal()`
`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.
`Valve` `getFirst()` Return the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).
`String` `getInfo()` Return descriptive information about this implementation class.
`ObjectName[]` `getValveObjectNames()`
`Valve[]` `getValves()` Return the set of Valves in the pipeline associated with this Container, including the basic Valve (if any).
`protected void` `initInternal()`
`boolean` `isAsyncSupported()` Returns true if all the valves in this pipeline support async, false otherwise
`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.
`protected void` `startInternal()` Start `Valve`s) in this pipeline and implement the requirements of `LifecycleBase.startInternal()`.
`protected void` `stopInternal()` Stop `Valve`s) in this pipeline and implement the requirements of `LifecycleBase.stopInternal()`.
`String` `toString()` Return a String representation of this component.

### Methods inherited from class org.apache.catalina.util.LifecycleBase

`addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.

#### info

    protected static final String info

Descriptive information about this implementation.

See Also:
  Constant Field Values

#### first

    protected Valve first

The first valve 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 String getInfo()

Return descriptive information about this implementation class.

#### isAsyncSupported

    public boolean isAsyncSupported()

Description copied from interface: `Pipeline`
Returns true if all the valves in this pipeline support async, false otherwise

Specified by:
  `isAsyncSupported` in interface `Pipeline`
Returns:
  true if all the valves in this pipeline support async, false otherwise

#### getContainer

    public Container getContainer()

Return the Container with which this Pipeline is associated.

Specified by:
  `getContainer` in interface `Contained`
Specified by:
  `getContainer` in interface `Pipeline`

#### setContainer

    public void setContainer(Container container)

Set the Container with which this Pipeline is associated.

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

#### initInternal

    protected void initInternal()

Specified by:
  `initInternal` in class `LifecycleBase`

#### startInternal

    protected void startInternal()
                          throws LifecycleException

Start `Valve`s) in this pipeline and implement the requirements of `LifecycleBase.startInternal()`.

Specified by:
  `startInternal` in class `LifecycleBase`
Throws:
  `LifecycleException` - if this component detects a fatal error that prevents this component from being used

#### stopInternal

    protected void stopInternal()
                         throws LifecycleException

Stop `Valve`s) in this pipeline and implement the requirements of `LifecycleBase.stopInternal()`.

Specified by:
  `stopInternal` in class `LifecycleBase`
Throws:
  `LifecycleException` - if this component detects a fatal error that prevents this component from being used

#### destroyInternal

    protected void destroyInternal()

Specified by:
  `destroyInternal` in class `LifecycleBase`

#### toString

    public String toString()

Return a String representation of this component.

Overrides:
  `toString` in class `Object`

#### 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). Prior 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:
  `IllegalArgumentException` - if this Container refused to accept the specified Valve
  `IllegalArgumentException` - if the specified Valve refuses to be associated with this Container
  `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`

#### getValveObjectNames

    public ObjectName[] getValveObjectNames()

#### 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

#### getFirst

    public Valve getFirst()

Description copied from interface: `Pipeline`

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

Specified by:
  `getFirst` in interface `Pipeline`