KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > components > context > PageRequestContext


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2006
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Felix Gnass [fgnass at neteye dot de]
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.components.context;
25
26 import java.util.HashMap JavaDoc;
27 import java.util.Map JavaDoc;
28
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30
31 import org.riotfamily.common.web.util.ServletUtils;
32
33 public class PageRequestContext {
34
35     private Object JavaDoc key;
36     
37     private Map JavaDoc parameters;
38     
39     private Map JavaDoc attributes;
40     
41     private String JavaDoc method;
42     
43     private String JavaDoc pathInfo;
44     
45     private String JavaDoc servletPath;
46     
47     private String JavaDoc queryString;
48     
49     private String JavaDoc requestURI;
50     
51     public PageRequestContext(Object JavaDoc key, HttpServletRequest JavaDoc request) {
52         this.key = key;
53         this.method = request.getMethod();
54         this.pathInfo = request.getPathInfo();
55         this.servletPath = request.getServletPath();
56         this.queryString = request.getQueryString();
57         this.requestURI = request.getRequestURI();
58         
59         this.attributes = ServletUtils.takeAttributesSnapshot(request);
60         this.parameters = new HashMap JavaDoc(request.getParameterMap());
61     }
62
63     public Object JavaDoc getKey() {
64         return this.key;
65     }
66     
67     public Map JavaDoc getAttributes() {
68         return this.attributes;
69     }
70
71     public String JavaDoc getMethod() {
72         return this.method;
73     }
74
75     public Map JavaDoc getParameters() {
76         return this.parameters;
77     }
78
79     public String JavaDoc getPathInfo() {
80         return this.pathInfo;
81     }
82
83     public String JavaDoc getQueryString() {
84         return this.queryString;
85     }
86
87     public String JavaDoc getRequestURI() {
88         return this.requestURI;
89     }
90
91     public String JavaDoc getServletPath() {
92         return this.servletPath;
93     }
94
95 }
96
Popular Tags