View Javadoc

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