Source Code Cross Referenced for ServletRequestWrapper.java in  » 6.0-JDK-Core » Servlet-API-by-tomcat » javax » servlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Servlet API by tomcat » javax.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2004 The Apache Software Foundation
003         *
004         * Licensed under the Apache License, Version 2.0 (the "License");
005         * you may not use this file except in compliance with the License.
006         * You may obtain a copy of the License at
007         *
008         *     http://www.apache.org/licenses/LICENSE-2.0
009         *
010         * Unless required by applicable law or agreed to in writing, software
011         * distributed under the License is distributed on an "AS IS" BASIS,
012         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013         * See the License for the specific language governing permissions and
014         * limitations under the License.
015         */
016        package javax.servlet;
017
018        import java.io.BufferedReader;
019        import java.io.IOException;
020        import java.util.Enumeration;
021        import java.util.Locale;
022        import java.util.Map;
023
024        /**
025         * 
026         * Provides a convenient implementation of the ServletRequest interface that
027         * can be subclassed by developers wishing to adapt the request to a Servlet.
028         * This class implements the Wrapper or Decorator pattern. Methods default to
029         * calling through to the wrapped request object.
030         * @since	v 2.3
031         * 
032         * 
033         *
034         * @see 	javax.servlet.ServletRequest
035         *
036         */
037
038        public class ServletRequestWrapper implements  ServletRequest {
039            private ServletRequest request;
040
041            /**
042             * Creates a ServletRequest adaptor wrapping the given request object. 
043             * @throws java.lang.IllegalArgumentException if the request is null
044             */
045
046            public ServletRequestWrapper(ServletRequest request) {
047                if (request == null) {
048                    throw new IllegalArgumentException("Request cannot be null");
049                }
050                this .request = request;
051            }
052
053            /**
054             * Return the wrapped request object.
055             */
056            public ServletRequest getRequest() {
057                return this .request;
058            }
059
060            /**
061             * Sets the request object being wrapped. 
062             * @throws java.lang.IllegalArgumentException if the request is null.
063             */
064
065            public void setRequest(ServletRequest request) {
066                if (request == null) {
067                    throw new IllegalArgumentException("Request cannot be null");
068                }
069                this .request = request;
070            }
071
072            /**
073             *
074             * The default behavior of this method is to call getAttribute(String name)
075             * on the wrapped request object.
076             */
077
078            public Object getAttribute(String name) {
079                return this .request.getAttribute(name);
080            }
081
082            /**
083             * The default behavior of this method is to return getAttributeNames()
084             * on the wrapped request object.
085             */
086
087            public Enumeration getAttributeNames() {
088                return this .request.getAttributeNames();
089            }
090
091            /**
092             * The default behavior of this method is to return getCharacterEncoding()
093             * on the wrapped request object.
094             */
095
096            public String getCharacterEncoding() {
097                return this .request.getCharacterEncoding();
098            }
099
100            /**
101             * The default behavior of this method is to set the character encoding
102             * on the wrapped request object.
103             */
104
105            public void setCharacterEncoding(String enc)
106                    throws java.io.UnsupportedEncodingException {
107                this .request.setCharacterEncoding(enc);
108            }
109
110            /**
111             * The default behavior of this method is to return getContentLength()
112             * on the wrapped request object.
113             */
114
115            public int getContentLength() {
116                return this .request.getContentLength();
117            }
118
119            /**
120             * The default behavior of this method is to return getContentType()
121             * on the wrapped request object.
122             */
123            public String getContentType() {
124                return this .request.getContentType();
125            }
126
127            /**
128             * The default behavior of this method is to return getInputStream()
129             * on the wrapped request object.
130             */
131
132            public ServletInputStream getInputStream() throws IOException {
133                return this .request.getInputStream();
134            }
135
136            /**
137             * The default behavior of this method is to return getParameter(String name)
138             * on the wrapped request object.
139             */
140
141            public String getParameter(String name) {
142                return this .request.getParameter(name);
143            }
144
145            /**
146             * The default behavior of this method is to return getParameterMap()
147             * on the wrapped request object.
148             */
149            public Map getParameterMap() {
150                return this .request.getParameterMap();
151            }
152
153            /**
154             * The default behavior of this method is to return getParameterNames()
155             * on the wrapped request object.
156             */
157
158            public Enumeration getParameterNames() {
159                return this .request.getParameterNames();
160            }
161
162            /**
163             * The default behavior of this method is to return getParameterValues(String name)
164             * on the wrapped request object.
165             */
166            public String[] getParameterValues(String name) {
167                return this .request.getParameterValues(name);
168            }
169
170            /**
171             * The default behavior of this method is to return getProtocol()
172             * on the wrapped request object.
173             */
174
175            public String getProtocol() {
176                return this .request.getProtocol();
177            }
178
179            /**
180             * The default behavior of this method is to return getScheme()
181             * on the wrapped request object.
182             */
183
184            public String getScheme() {
185                return this .request.getScheme();
186            }
187
188            /**
189             * The default behavior of this method is to return getServerName()
190             * on the wrapped request object.
191             */
192            public String getServerName() {
193                return this .request.getServerName();
194            }
195
196            /**
197             * The default behavior of this method is to return getServerPort()
198             * on the wrapped request object.
199             */
200
201            public int getServerPort() {
202                return this .request.getServerPort();
203            }
204
205            /**
206             * The default behavior of this method is to return getReader()
207             * on the wrapped request object.
208             */
209
210            public BufferedReader getReader() throws IOException {
211                return this .request.getReader();
212            }
213
214            /**
215             * The default behavior of this method is to return getRemoteAddr()
216             * on the wrapped request object.
217             */
218
219            public String getRemoteAddr() {
220                return this .request.getRemoteAddr();
221            }
222
223            /**
224             * The default behavior of this method is to return getRemoteHost()
225             * on the wrapped request object.
226             */
227
228            public String getRemoteHost() {
229                return this .request.getRemoteHost();
230            }
231
232            /**
233             * The default behavior of this method is to return setAttribute(String name, Object o)
234             * on the wrapped request object.
235             */
236
237            public void setAttribute(String name, Object o) {
238                this .request.setAttribute(name, o);
239            }
240
241            /**
242             * The default behavior of this method is to call removeAttribute(String name)
243             * on the wrapped request object.
244             */
245            public void removeAttribute(String name) {
246                this .request.removeAttribute(name);
247            }
248
249            /**
250             * The default behavior of this method is to return getLocale()
251             * on the wrapped request object.
252             */
253
254            public Locale getLocale() {
255                return this .request.getLocale();
256            }
257
258            /**
259             * The default behavior of this method is to return getLocales()
260             * on the wrapped request object.
261             */
262
263            public Enumeration getLocales() {
264                return this .request.getLocales();
265            }
266
267            /**
268             * The default behavior of this method is to return isSecure()
269             * on the wrapped request object.
270             */
271
272            public boolean isSecure() {
273                return this .request.isSecure();
274            }
275
276            /**
277             * The default behavior of this method is to return getRequestDispatcher(String path)
278             * on the wrapped request object.
279             */
280
281            public RequestDispatcher getRequestDispatcher(String path) {
282                return this .request.getRequestDispatcher(path);
283            }
284
285            /**
286             * The default behavior of this method is to return getRealPath(String path)
287             * on the wrapped request object.
288             */
289
290            public String getRealPath(String path) {
291                return this .request.getRealPath(path);
292            }
293
294            /**
295             * The default behavior of this method is to return
296             * getRemotePort() on the wrapped request object.
297             *
298             * @since 2.4
299             */
300            public int getRemotePort() {
301                return this .request.getRemotePort();
302            }
303
304            /**
305             * The default behavior of this method is to return
306             * getLocalName() on the wrapped request object.
307             *
308             * @since 2.4
309             */
310            public String getLocalName() {
311                return this .request.getLocalName();
312            }
313
314            /**
315             * The default behavior of this method is to return
316             * getLocalAddr() on the wrapped request object.
317             *
318             * @since 2.4
319             */
320            public String getLocalAddr() {
321                return this .request.getLocalAddr();
322            }
323
324            /**
325             * The default behavior of this method is to return
326             * getLocalPort() on the wrapped request object.
327             *
328             * @since 2.4
329             */
330            public int getLocalPort() {
331                return this.request.getLocalPort();
332            }
333
334        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.