KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > connector > HttpRequestFacade


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina.connector;
30
31
32 import java.security.Principal JavaDoc;
33 import java.util.Locale JavaDoc;
34 import java.util.Enumeration JavaDoc;
35 import javax.servlet.RequestDispatcher JavaDoc;
36 import javax.servlet.ServletContext JavaDoc;
37 import javax.servlet.ServletException JavaDoc;
38 import javax.servlet.ServletInputStream JavaDoc;
39 import javax.servlet.ServletRequest JavaDoc;
40 import javax.servlet.http.HttpServletRequest JavaDoc;
41 import javax.servlet.http.Cookie JavaDoc;
42 import javax.servlet.http.HttpSession JavaDoc;
43 import org.apache.catalina.HttpRequest;
44 import org.apache.catalina.session.StandardSessionFacade;
45
46
47 /**
48  * Facade class that wraps a Catalina-internal <b>HttpRequest</b>
49  * object. All methods are delegated to the wrapped request.
50  *
51  * @author Remy Maucherat
52  * @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:29 $
53  */

54
55 public final class HttpRequestFacade
56     extends RequestFacade
57     implements HttpServletRequest JavaDoc {
58
59
60     // ----------------------------------------------------------- Constructors
61

62
63     /**
64      * Construct a wrapper for the specified request.
65      *
66      * @param request The request to be wrapped
67      */

68     public HttpRequestFacade(HttpRequest request) {
69         super(request);
70     }
71
72
73     // --------------------------------------------- HttpServletRequest Methods
74

75
76     public String JavaDoc getAuthType() {
77         return ((HttpServletRequest JavaDoc) request).getAuthType();
78     }
79
80
81     public Cookie JavaDoc[] getCookies() {
82         return ((HttpServletRequest JavaDoc) request).getCookies();
83     }
84
85
86     public long getDateHeader(String JavaDoc name) {
87         return ((HttpServletRequest JavaDoc) request).getDateHeader(name);
88     }
89
90
91     public String JavaDoc getHeader(String JavaDoc name) {
92         return ((HttpServletRequest JavaDoc) request).getHeader(name);
93     }
94
95
96     public Enumeration JavaDoc getHeaders(String JavaDoc name) {
97         return ((HttpServletRequest JavaDoc) request).getHeaders(name);
98     }
99
100
101     public Enumeration JavaDoc getHeaderNames() {
102         return ((HttpServletRequest JavaDoc) request).getHeaderNames();
103     }
104
105
106     public int getIntHeader(String JavaDoc name) {
107         return ((HttpServletRequest JavaDoc) request).getIntHeader(name);
108     }
109
110
111     public String JavaDoc getMethod() {
112         return ((HttpServletRequest JavaDoc) request).getMethod();
113     }
114
115
116     public String JavaDoc getPathInfo() {
117         return ((HttpServletRequest JavaDoc) request).getPathInfo();
118     }
119
120
121     public String JavaDoc getPathTranslated() {
122         return ((HttpServletRequest JavaDoc) request).getPathTranslated();
123     }
124
125
126     public String JavaDoc getContextPath() {
127         return ((HttpServletRequest JavaDoc) request).getContextPath();
128     }
129
130
131     public String JavaDoc getQueryString() {
132         return ((HttpServletRequest JavaDoc) request).getQueryString();
133     }
134
135
136     public String JavaDoc getRemoteUser() {
137         return ((HttpServletRequest JavaDoc) request).getRemoteUser();
138     }
139
140
141     public boolean isUserInRole(String JavaDoc role) {
142         return ((HttpServletRequest JavaDoc) request).isUserInRole(role);
143     }
144
145
146     public java.security.Principal JavaDoc getUserPrincipal() {
147         return ((HttpServletRequest JavaDoc) request).getUserPrincipal();
148     }
149
150
151     public String JavaDoc getRequestedSessionId() {
152         return ((HttpServletRequest JavaDoc) request).getRequestedSessionId();
153     }
154
155
156     public String JavaDoc getRequestURI() {
157         return ((HttpServletRequest JavaDoc) request).getRequestURI();
158     }
159
160
161     public StringBuffer JavaDoc getRequestURL() {
162         return ((HttpServletRequest JavaDoc) request).getRequestURL();
163     }
164
165
166     public String JavaDoc getServletPath() {
167         return ((HttpServletRequest JavaDoc) request).getServletPath();
168     }
169
170
171     public HttpSession JavaDoc getSession(boolean create) {
172         HttpSession JavaDoc session =
173             ((HttpServletRequest JavaDoc) request).getSession(create);
174         if (session == null)
175             return null;
176         else
177             return new StandardSessionFacade(session);
178     }
179
180
181     public HttpSession JavaDoc getSession() {
182         return getSession(true);
183     }
184
185
186     public boolean isRequestedSessionIdValid() {
187         return ((HttpServletRequest JavaDoc) request).isRequestedSessionIdValid();
188     }
189
190
191     public boolean isRequestedSessionIdFromCookie() {
192         return ((HttpServletRequest JavaDoc) request).isRequestedSessionIdFromCookie();
193     }
194
195
196     public boolean isRequestedSessionIdFromURL() {
197         return ((HttpServletRequest JavaDoc) request).isRequestedSessionIdFromURL();
198     }
199
200
201     public boolean isRequestedSessionIdFromUrl() {
202         return ((HttpServletRequest JavaDoc) request).isRequestedSessionIdFromURL();
203     }
204
205
206 }
207
Popular Tags