001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005//     http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.services;
014
015import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
016
017import java.io.IOException;
018
019/**
020 * Handler interface for component event requests. Component event requests <em>do things</em> such as process a form
021 * submission or otherwise change state. In the majority of cases, after the component event, a redirect response is
022 * sent to the client which, in turn, causes a page render.
023 *
024 * The ComponentEventRequestHandler service is a pipeline, allowing extensibility via contributed {@linkplain
025 * org.apache.tapestry5.services.ComponentEventRequestFilter filters}.    It may be distinguished by the @{@link
026 * org.apache.tapestry5.services.Traditional} marker annotation.
027 *
028 * A second service, AjaxComponentEventRequestHandler is also a pipeline and may be distinguished by the @{@link
029 * org.apache.tapestry5.services.Ajax} marker annotation.
030 *
031 * @see org.apache.tapestry5.corelib.components.ActionLink
032 * @see org.apache.tapestry5.corelib.components.Form
033 */
034@UsesOrderedConfiguration(ComponentEventRequestFilter.class)
035public interface ComponentEventRequestHandler
036{
037    /**
038     * Handler for a component action request which will trigger an event on a component and use the return value to
039     * send a response to the client (typically, a redirect to a page render URL).
040     *
041     * @param parameters defining the requst
042     */
043    void handle(ComponentEventRequestParameters parameters) throws IOException;
044}