View Javadoc

1   package org.apache.turbine.pipeline;
2   
3   
4   /*
5    * Copyright 2001-2004 The Apache Software Foundation.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License")
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  
21  import java.io.IOException;
22  
23  import org.apache.turbine.util.TurbineException;
24  
25  /***
26   * <p>A <b>ValveContext</b> is the mechanism by which a Valve can trigger the
27   * execution of the next Valve in a Pipeline, without having to know anything
28   * about the internal implementation mechanisms.  An instance of a class
29   * implementing this interface is passed as a parameter to the
30   * <code>Valve.invoke()</code> method of each executed Valve.</p>
31   *
32   * <p><strong>IMPLEMENTATION NOTE</strong>: It is up to the implementation of
33   * ValveContext to ensure that simultaneous requests being processed (by
34   * separate threads) through the same Pipeline do not interfere with each
35   * other's flow of control.</p>
36   *
37   * @author Craig R. McClanahan
38   * @author Gunnar Rjnning
39   * @author Peter Donald
40   * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
41   * @version $Revision: 222043 $ $Date: 2004-12-07 04:47:33 +1100 (Tue, 07 Dec 2004) $
42   */
43  public interface ValveContext
44  {
45      /***
46       * <p>Cause the <code>invoke()</code> method of the next Valve
47       * that is part of the Pipeline currently being processed (if any)
48       * to be executed, passing on the specified request and response
49       * objects plus this <code>ValveContext</code> instance.
50       * Exceptions thrown by a subsequently executed Valve will be
51       * passed on to our caller.</p>
52       *
53       * <p>If there are no more Valves to be executed, execution of
54       * this method will result in a no op.</p>
55       *
56       * @param data The run-time information, including the servlet
57       * request and response we are processing.
58       *
59       * @exception IOException Thrown by a subsequent Valve.
60       * @exception TurbineException Thrown by a subsequent Valve.
61       * @exception TurbineException No further Valves configured in the
62       * Pipeline currently being processed.
63       */
64      public void invokeNext(PipelineData data)
65          throws IOException, TurbineException;
66  }