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$ $Date$
45 */
46 @FunctionalInterface
47 public interface ValveContext
48 {
49 /**
50 * <p>Cause the <code>invoke()</code> method of the next Valve
51 * that is part of the Pipeline currently being processed (if any)
52 * to be executed, passing on the specified request and response
53 * objects plus this <code>ValveContext</code> instance.
54 * Exceptions thrown by a subsequently executed Valve will be
55 * passed on to our caller.</p>
56 *
57 * <p>If there are no more Valves to be executed, execution of
58 * this method will result in a no op.</p>
59 *
60 * @param pipelineData The run-time information, including the servlet
61 * request and response we are processing.
62 *
63 * @throws IOException Thrown by a subsequent Valve.
64 * @throws TurbineException Thrown by a subsequent Valve.
65 * @throws TurbineException No further Valves configured in the
66 * Pipeline currently being processed.
67 */
68 void invokeNext(PipelineData pipelineData)
69 throws IOException, TurbineException;
70 }