001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.request;
018
019public interface IRequestCycle
020{
021        /**
022         * Get the active response at the request cycle.
023         * 
024         * @return response
025         */
026        Response getResponse();
027
028        /**
029         * Replaces the current {@link Response} with new {@link Response} instance. The original response
030         * is always restored after the {@link IRequestHandler#respond(IRequestCycle)} method is
031         * finished.
032         * 
033         * @param response
034         * @return Response being replaced.
035         */
036        Response setResponse(Response response);
037
038        /**
039         * @return the request that originated this cycle
040         */
041        Request getRequest();
042
043        /**
044         * Schedule the request handler to be executed after the current one.
045         * 
046         * @param handler
047         */
048        void scheduleRequestHandlerAfterCurrent(IRequestHandler handler);
049
050        /**
051         * Returns {@link UrlRenderer} for this {@link IRequestCycle}.
052         * 
053         * @return UrlRenderer instance.
054         */
055        UrlRenderer getUrlRenderer();
056}