|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
HttpServletRequestWrapper.java | - | 0% | 0% | 0% |
|
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 | package javax.servlet.http; | |
17 | ||
18 | import javax.servlet.ServletRequestWrapper; | |
19 | import java.util.Enumeration; | |
20 | ||
21 | /** | |
22 | * | |
23 | * Provides a convenient implementation of the HttpServletRequest interface that | |
24 | * can be subclassed by developers wishing to adapt the request to a Servlet. | |
25 | * This class implements the Wrapper or Decorator pattern. Methods default to | |
26 | * calling through to the wrapped request object. | |
27 | * | |
28 | * | |
29 | * @see javax.servlet.http.HttpServletRequest | |
30 | * @since v 2.3 | |
31 | * | |
32 | */ | |
33 | ||
34 | ||
35 | public class HttpServletRequestWrapper extends ServletRequestWrapper implements HttpServletRequest { | |
36 | ||
37 | /** | |
38 | * Constructs a request object wrapping the given request. | |
39 | * @throws java.lang.IllegalArgumentException if the request is null | |
40 | */ | |
41 | 0 | public HttpServletRequestWrapper(HttpServletRequest request) { |
42 | 0 | super(request); |
43 | } | |
44 | ||
45 | 0 | private HttpServletRequest _getHttpServletRequest() { |
46 | 0 | return (HttpServletRequest) super.getRequest(); |
47 | } | |
48 | ||
49 | /** | |
50 | * The default behavior of this method is to return getAuthType() | |
51 | * on the wrapped request object. | |
52 | */ | |
53 | ||
54 | 0 | public String getAuthType() { |
55 | 0 | return this._getHttpServletRequest().getAuthType(); |
56 | } | |
57 | ||
58 | /** | |
59 | * The default behavior of this method is to return getCookies() | |
60 | * on the wrapped request object. | |
61 | */ | |
62 | 0 | public Cookie[] getCookies() { |
63 | 0 | return this._getHttpServletRequest().getCookies(); |
64 | } | |
65 | ||
66 | /** | |
67 | * The default behavior of this method is to return getDateHeader(String name) | |
68 | * on the wrapped request object. | |
69 | */ | |
70 | 0 | public long getDateHeader(String name) { |
71 | 0 | return this._getHttpServletRequest().getDateHeader(name); |
72 | } | |
73 | ||
74 | /** | |
75 | * The default behavior of this method is to return getHeader(String name) | |
76 | * on the wrapped request object. | |
77 | */ | |
78 | 0 | public String getHeader(String name) { |
79 | 0 | return this._getHttpServletRequest().getHeader(name); |
80 | } | |
81 | ||
82 | /** | |
83 | * The default behavior of this method is to return getHeaders(String name) | |
84 | * on the wrapped request object. | |
85 | */ | |
86 | 0 | public Enumeration getHeaders(String name) { |
87 | 0 | return this._getHttpServletRequest().getHeaders(name); |
88 | } | |
89 | ||
90 | /** | |
91 | * The default behavior of this method is to return getHeaderNames() | |
92 | * on the wrapped request object. | |
93 | */ | |
94 | ||
95 | 0 | public Enumeration getHeaderNames() { |
96 | 0 | return this._getHttpServletRequest().getHeaderNames(); |
97 | } | |
98 | ||
99 | /** | |
100 | * The default behavior of this method is to return getIntHeader(String name) | |
101 | * on the wrapped request object. | |
102 | */ | |
103 | ||
104 | 0 | public int getIntHeader(String name) { |
105 | 0 | return this._getHttpServletRequest().getIntHeader(name); |
106 | } | |
107 | ||
108 | /** | |
109 | * The default behavior of this method is to return getMethod() | |
110 | * on the wrapped request object. | |
111 | */ | |
112 | 0 | public String getMethod() { |
113 | 0 | return this._getHttpServletRequest().getMethod(); |
114 | } | |
115 | ||
116 | /** | |
117 | * The default behavior of this method is to return getPathInfo() | |
118 | * on the wrapped request object. | |
119 | */ | |
120 | 0 | public String getPathInfo() { |
121 | 0 | return this._getHttpServletRequest().getPathInfo(); |
122 | } | |
123 | ||
124 | /** | |
125 | * The default behavior of this method is to return getPathTranslated() | |
126 | * on the wrapped request object. | |
127 | */ | |
128 | ||
129 | 0 | public String getPathTranslated() { |
130 | 0 | return this._getHttpServletRequest().getPathTranslated(); |
131 | } | |
132 | ||
133 | /** | |
134 | * The default behavior of this method is to return getContextPath() | |
135 | * on the wrapped request object. | |
136 | */ | |
137 | 0 | public String getContextPath() { |
138 | 0 | return this._getHttpServletRequest().getContextPath(); |
139 | } | |
140 | ||
141 | /** | |
142 | * The default behavior of this method is to return getQueryString() | |
143 | * on the wrapped request object. | |
144 | */ | |
145 | 0 | public String getQueryString() { |
146 | 0 | return this._getHttpServletRequest().getQueryString(); |
147 | } | |
148 | ||
149 | /** | |
150 | * The default behavior of this method is to return getRemoteUser() | |
151 | * on the wrapped request object. | |
152 | */ | |
153 | 0 | public String getRemoteUser() { |
154 | 0 | return this._getHttpServletRequest().getRemoteUser(); |
155 | } | |
156 | ||
157 | ||
158 | /** | |
159 | * The default behavior of this method is to return isUserInRole(String role) | |
160 | * on the wrapped request object. | |
161 | */ | |
162 | 0 | public boolean isUserInRole(String role) { |
163 | 0 | return this._getHttpServletRequest().isUserInRole(role); |
164 | } | |
165 | ||
166 | ||
167 | ||
168 | /** | |
169 | * The default behavior of this method is to return getUserPrincipal() | |
170 | * on the wrapped request object. | |
171 | */ | |
172 | 0 | public java.security.Principal getUserPrincipal() { |
173 | 0 | return this._getHttpServletRequest().getUserPrincipal(); |
174 | } | |
175 | ||
176 | ||
177 | /** | |
178 | * The default behavior of this method is to return getRequestedSessionId() | |
179 | * on the wrapped request object. | |
180 | */ | |
181 | 0 | public String getRequestedSessionId() { |
182 | 0 | return this._getHttpServletRequest().getRequestedSessionId(); |
183 | } | |
184 | ||
185 | /** | |
186 | * The default behavior of this method is to return getRequestURI() | |
187 | * on the wrapped request object. | |
188 | */ | |
189 | 0 | public String getRequestURI() { |
190 | 0 | return this._getHttpServletRequest().getRequestURI(); |
191 | } | |
192 | /** | |
193 | * The default behavior of this method is to return getRequestURL() | |
194 | * on the wrapped request object. | |
195 | */ | |
196 | 0 | public StringBuffer getRequestURL() { |
197 | 0 | return this._getHttpServletRequest().getRequestURL(); |
198 | } | |
199 | ||
200 | ||
201 | /** | |
202 | * The default behavior of this method is to return getServletPath() | |
203 | * on the wrapped request object. | |
204 | */ | |
205 | 0 | public String getServletPath() { |
206 | 0 | return this._getHttpServletRequest().getServletPath(); |
207 | } | |
208 | ||
209 | ||
210 | /** | |
211 | * The default behavior of this method is to return getSession(boolean create) | |
212 | * on the wrapped request object. | |
213 | */ | |
214 | 0 | public HttpSession getSession(boolean create) { |
215 | 0 | return this._getHttpServletRequest().getSession(create); |
216 | } | |
217 | ||
218 | /** | |
219 | * The default behavior of this method is to return getSession() | |
220 | * on the wrapped request object. | |
221 | */ | |
222 | 0 | public HttpSession getSession() { |
223 | 0 | return this._getHttpServletRequest().getSession(); |
224 | } | |
225 | ||
226 | /** | |
227 | * The default behavior of this method is to return isRequestedSessionIdValid() | |
228 | * on the wrapped request object. | |
229 | */ | |
230 | ||
231 | 0 | public boolean isRequestedSessionIdValid() { |
232 | 0 | return this._getHttpServletRequest().isRequestedSessionIdValid(); |
233 | } | |
234 | ||
235 | ||
236 | /** | |
237 | * The default behavior of this method is to return isRequestedSessionIdFromCookie() | |
238 | * on the wrapped request object. | |
239 | */ | |
240 | 0 | public boolean isRequestedSessionIdFromCookie() { |
241 | 0 | return this._getHttpServletRequest().isRequestedSessionIdFromCookie(); |
242 | } | |
243 | ||
244 | /** | |
245 | * The default behavior of this method is to return isRequestedSessionIdFromURL() | |
246 | * on the wrapped request object. | |
247 | */ | |
248 | 0 | public boolean isRequestedSessionIdFromURL() { |
249 | 0 | return this._getHttpServletRequest().isRequestedSessionIdFromURL(); |
250 | } | |
251 | ||
252 | /** | |
253 | * The default behavior of this method is to return isRequestedSessionIdFromUrl() | |
254 | * on the wrapped request object. | |
255 | */ | |
256 | 0 | public boolean isRequestedSessionIdFromUrl() { |
257 | 0 | return this._getHttpServletRequest().isRequestedSessionIdFromUrl(); |
258 | } | |
259 | ||
260 | ||
261 | ||
262 | } |
|