    001package org.apache.turbine.pipeline;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024import java.io.IOException;
    025
    026import org.apache.turbine.util.TurbineException;
    027
    028/**
    029 * <p>A <b>ValveContext</b> is the mechanism by which a Valve can trigger the
    030 * execution of the next Valve in a Pipeline, without having to know anything
    031 * about the internal implementation mechanisms.  An instance of a class
    032 * implementing this interface is passed as a parameter to the
    033 * <code>Valve.invoke()</code> method of each executed Valve.</p>
    034 *
    035 * <p><strong>IMPLEMENTATION NOTE</strong>: It is up to the implementation of
    036 * ValveContext to ensure that simultaneous requests being processed (by
    037 * separate threads) through the same Pipeline do not interfere with each
    038 * other's flow of control.</p>
    039 *
    040 * @author Craig R. McClanahan
    041 * @author Gunnar Rjnning
    042 * @author Peter Donald
    043 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    044 * @version $Revision: 1706239 $ $Date: 2015-10-01 15:18:35 +0200 (Thu, 01 Oct 2015) $
    045 */
    046public interface ValveContext
    047{
    048    /**
    049     * <p>Cause the <code>invoke()</code> method of the next Valve
    050     * that is part of the Pipeline currently being processed (if any)
    051     * to be executed, passing on the specified request and response
    052     * objects plus this <code>ValveContext</code> instance.
    053     * Exceptions thrown by a subsequently executed Valve will be
    054     * passed on to our caller.</p>
    055     *
    056     * <p>If there are no more Valves to be executed, execution of
    057     * this method will result in a no op.</p>
    058     *
    059     * @param pipelineData The run-time information, including the servlet
    060     * request and response we are processing.
    061     *
    062     * @exception IOException Thrown by a subsequent Valve.
    063     * @exception TurbineException Thrown by a subsequent Valve.
    064     * @exception TurbineException No further Valves configured in the
    065     * Pipeline currently being processed.
    066     */
    067    public void invokeNext(PipelineData pipelineData)
    068        throws IOException, TurbineException;
    069}