KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > RequestContext


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow;
19
20 import javax.servlet.ServletRequest JavaDoc;
21 import javax.servlet.ServletResponse JavaDoc;
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23 import javax.servlet.http.HttpServletResponse JavaDoc;
24
25 /**
26  * Base request/response context.
27  */

28 public class RequestContext
29 {
30     private ServletRequest JavaDoc _request;
31     private ServletResponse JavaDoc _response;
32
33     public RequestContext( ServletRequest JavaDoc request, ServletResponse JavaDoc response )
34     {
35         _request = request;
36         _response = response;
37     }
38
39     public ServletRequest JavaDoc getRequest()
40     {
41         return _request;
42     }
43
44     public ServletResponse JavaDoc getResponse()
45     {
46         return _response;
47     }
48     
49     HttpServletRequest JavaDoc getHttpRequest()
50     {
51         assert _request instanceof HttpServletRequest JavaDoc : "HttpServletRequest is currently required";
52         return ( HttpServletRequest JavaDoc ) _request;
53     }
54     
55     HttpServletResponse JavaDoc getHttpResponse()
56     {
57         assert _response instanceof HttpServletResponse JavaDoc : "HttpServletResponse is currently required";
58         return ( HttpServletResponse JavaDoc ) _response;
59     }
60 }
61
Popular Tags