KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > common > web > util > ServletMappingHelper


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.common.web.util;
25
26 import javax.servlet.http.HttpServletRequest JavaDoc;
27
28 import org.springframework.web.util.UrlPathHelper;
29
30 /**
31  * @deprecated Please use an UrlPathHelper or the {@link ServletUtils}.
32  */

33 public class ServletMappingHelper extends UrlPathHelper {
34     
35     boolean useOriginalRequest = false;
36         
37     public ServletMappingHelper() {
38     }
39     
40     public ServletMappingHelper(boolean useOriginalRequest) {
41         this.useOriginalRequest = useOriginalRequest;
42     }
43
44     public void setUseOriginalRequest(boolean useOriginalRequest) {
45         this.useOriginalRequest = useOriginalRequest;
46     }
47
48     public String JavaDoc getLookupPathForRequest(HttpServletRequest JavaDoc request) {
49         if (useOriginalRequest) {
50             return ServletUtils.getOriginatingPathWithoutServletMapping(request);
51         }
52         return super.getLookupPathForRequest(request);
53     }
54             
55     public String JavaDoc getServletPath(HttpServletRequest JavaDoc request) {
56         if (useOriginalRequest) {
57             return ServletUtils.getOriginatingServletPath(request);
58         }
59         return super.getServletPath(request);
60     }
61
62     public String JavaDoc getContextPath(HttpServletRequest JavaDoc request) {
63         if (useOriginalRequest) {
64             return getOriginatingContextPath(request);
65         }
66         return super.getContextPath(request);
67     }
68
69     public String JavaDoc getRequestUri(HttpServletRequest JavaDoc request) {
70         if (useOriginalRequest) {
71             return getOriginatingRequestUri(request);
72         }
73         return super.getRequestUri(request);
74     }
75     
76     public String JavaDoc getQueryString(HttpServletRequest JavaDoc request) {
77         if (useOriginalRequest) {
78             return getOriginatingQueryString(request);
79         }
80         return request.getQueryString();
81     }
82
83     public String JavaDoc getServletPrefix(HttpServletRequest JavaDoc request) {
84         return ServletUtils.getServletPrefix(request);
85     }
86     
87     public String JavaDoc getServletSuffix(HttpServletRequest JavaDoc request) {
88         return ServletUtils.getServletSuffix(request);
89     }
90     
91     public String JavaDoc getRootPath(HttpServletRequest JavaDoc request) {
92         return ServletUtils.getRootPath(request);
93     }
94
95 }
96
Popular Tags