001// Copyright 2009 Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.services;
016
017import java.io.IOException;
018
019/**
020 * Filter interface for {@link org.apache.tapestry5.services.ComponentRequestHandler}.
021 */
022public interface ComponentRequestFilter
023{
024    /**
025     * Handler for a component action request which will trigger an event on a component and use the return value to
026     * send a response to the client (typically, a redirect to a page render URL).
027     *
028     * @param parameters defining the requst
029     * @param handler    next handler in the pipeline
030     */
031    void handleComponentEvent(ComponentEventRequestParameters parameters, ComponentRequestHandler handler)
032            throws IOException;
033
034    /**
035     * Invoked to activate and render a page. In certain cases, based on values returned when activating the page, a
036     * {@link org.apache.tapestry5.services.ComponentEventResultProcessor} may be used to send an alternate response
037     * (typically, a redirect).
038     *
039     * @param parameters defines the page name and activation context
040     * @param handler    next handler in the pipeline
041     */
042    void handlePageRender(PageRenderRequestParameters parameters, ComponentRequestHandler handler) throws IOException;
043}