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.cycle;
018
019import org.apache.wicket.request.IExceptionMapper;
020import org.apache.wicket.request.IRequestMapper;
021import org.apache.wicket.request.Request;
022import org.apache.wicket.request.Response;
023
024
025/**
026 * Represents the context for the request cycle. This class is mainly a grouping parameter for the
027 * {@link RequestCycle} constructor. It is only necessary to future-proof the API by making sure
028 * method signatures do not change if further parameters are introduced at a later time.
029 * <p>
030 * NOTE: Once a {@link RequestCycle} is instantiated using an instance of this class, the setters
031 * will have no further effect on the request cycle.
032 * </p>
033 * 
034 * @author igor.vaynberg
035 */
036public final class RequestCycleContext
037{
038        private Request request;
039
040        private Response response;
041
042        private IRequestMapper requestMapper;
043
044        private IExceptionMapper exceptionMapper;
045
046        /**
047         * Construct.
048         * 
049         * @param request
050         * @param response
051         * @param requestMapper
052         * @param exceptionMapper
053         */
054        public RequestCycleContext(Request request, Response response, IRequestMapper requestMapper,
055                IExceptionMapper exceptionMapper)
056        {
057                this.request = request;
058                this.response = response;
059                this.requestMapper = requestMapper;
060                this.exceptionMapper = exceptionMapper;
061        }
062
063        /**
064         * @return request
065         */
066        public Request getRequest()
067        {
068                return request;
069        }
070
071        /**
072         * @return response
073         */
074        public Response getResponse()
075        {
076                return response;
077        }
078
079        /**
080         * @return requst mapper
081         */
082        public IRequestMapper getRequestMapper()
083        {
084                return requestMapper;
085        }
086
087
088        /**
089         * @return exception mapper
090         */
091        public IExceptionMapper getExceptionMapper()
092        {
093                return exceptionMapper;
094        }
095
096        /**
097         * @param request
098         */
099        public void setRequest(Request request)
100        {
101                this.request = request;
102        }
103
104        /**
105         * @param response
106         */
107        public void setResponse(Response response)
108        {
109                this.response = response;
110        }
111
112        /**
113         * @param requestMapper
114         */
115        public void setRequestMapper(IRequestMapper requestMapper)
116        {
117                this.requestMapper = requestMapper;
118        }
119
120        /**
121         * @param exceptionMapper
122         */
123        public void setExceptionMapper(IExceptionMapper exceptionMapper)
124        {
125                this.exceptionMapper = exceptionMapper;
126        }
127}