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

    • 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.
    • first

      protected Valve first
      The first valve associated with this Pipeline.
  • Constructor Details

    • 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 Details

    • 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
    • findNonAsyncValves

      public void findNonAsyncValves(Set<String> result)
      Description copied from interface: Pipeline
      Identifies the Valves, if any, in this Pipeline that do not support async.
      Specified by:
      findNonAsyncValves in interface Pipeline
      Parameters:
      result - The Set to which the fully qualified class names of each Valve in this Pipeline that does not support async will be added
    • getContainer

      public Container getContainer()
      Description copied from interface: Contained
      Get the Container with which this instance is associated.
      Specified by:
      getContainer in interface Contained
      Returns:
      The Container with which this instance is associated or null if not associated with a Container
    • setContainer

      public void setContainer(Container container)
      Description copied from interface: Contained
      Set the Container with which this instance is associated.
      Specified by:
      setContainer in interface Contained
      Parameters:
      container - The Container instance with which this instance is to be associated, or null to disassociate this instance from any Container
    • initInternal

      protected void initInternal()
      Description copied from class: LifecycleBase
      Sub-classes implement this method to perform any instance initialisation required.
      Specified by:
      initInternal in class LifecycleBase
    • startInternal

      protected void startInternal() throws LifecycleException
      Description copied from class: LifecycleBase
      Sub-classes must ensure that the state is changed to LifecycleState.STARTING during the execution of this method. Changing state will trigger the Lifecycle.START_EVENT event. If a component fails to start it may either throw a LifecycleException which will cause it's parent to fail to start or it can place itself in the error state in which case LifecycleBase.stop() will be called on the failed component but the parent component will continue to start normally.
      Specified by:
      startInternal in class LifecycleBase
      Throws:
      LifecycleException - Start error occurred
    • stopInternal

      protected void stopInternal() throws LifecycleException
      Description copied from class: LifecycleBase
      Sub-classes must ensure that the state is changed to LifecycleState.STOPPING during the execution of this method. Changing state will trigger the Lifecycle.STOP_EVENT event.
      Specified by:
      stopInternal in class LifecycleBase
      Throws:
      LifecycleException - Stop error occurred
    • destroyInternal

      protected void destroyInternal()
      Description copied from class: LifecycleBase
      Sub-classes implement this method to perform any instance destruction required.
      Specified by:
      destroyInternal in class LifecycleBase
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBasic

      public Valve getBasic()
      Specified by:
      getBasic in interface Pipeline
      Returns:
      the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).
    • setBasic

      public void setBasic(Valve valve)
      Description copied from interface: Pipeline

      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)
      Description copied from interface: Pipeline

      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.

      Implementation note: Implementations are expected to trigger the Container.ADD_VALVE_EVENT for the associated container if this call is successful.

      Specified by:
      addValve in interface Pipeline
      Parameters:
      valve - Valve to be added
    • getValves

      public Valve[] getValves()
      Specified by:
      getValves in interface Pipeline
      Returns:
      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.
    • getValveObjectNames

      public ObjectName[] getValveObjectNames()
    • removeValve

      public void removeValve(Valve valve)
      Description copied from interface: Pipeline
      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.

      Implementation note: Implementations are expected to trigger the Container.REMOVE_VALVE_EVENT for the associated container if this call is successful.

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

      public Valve getFirst()
      Specified by:
      getFirst in interface Pipeline
      Returns:
      the Valve instance that has been distinguished as the basic Valve for this Pipeline (if any).