Source Code Cross Referenced for ServletResponseWrapper.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.IOException;
019        import java.io.PrintWriter;
020        import java.util.Locale;
021
022        /**
023         * 
024         * Provides a convenient implementation of the ServletResponse interface that
025         * can be subclassed by developers wishing to adapt the response from a Servlet.
026         * This class implements the Wrapper or Decorator pattern. Methods default to
027         * calling through to the wrapped response object.
028         * 
029         * @author 	Various
030         * @version 	$Version$
031         * @since	v 2.3
032         *
033         * @see 	javax.servlet.ServletResponse
034         *
035         */
036
037        public class ServletResponseWrapper implements  ServletResponse {
038            private ServletResponse response;
039
040            /**
041             * Creates a ServletResponse adaptor wrapping the given response object.
042             * @throws java.lang.IllegalArgumentException if the response is null.
043             */
044
045            public ServletResponseWrapper(ServletResponse response) {
046                if (response == null) {
047                    throw new IllegalArgumentException(
048                            "Response cannot be null");
049                }
050                this .response = response;
051            }
052
053            /**
054             * Return the wrapped ServletResponse object.
055             */
056
057            public ServletResponse getResponse() {
058                return this .response;
059            }
060
061            /**
062             * Sets the response being wrapped. 
063             * @throws java.lang.IllegalArgumentException if the response is null.
064             */
065
066            public void setResponse(ServletResponse response) {
067                if (response == null) {
068                    throw new IllegalArgumentException(
069                            "Response cannot be null");
070                }
071                this .response = response;
072            }
073
074            /**
075             * The default behavior of this method is to call setCharacterEncoding(String charset)
076             * on the wrapped response object.
077             *
078             * @since 2.4
079             */
080
081            public void setCharacterEncoding(String charset) {
082                this .response.setCharacterEncoding(charset);
083            }
084
085            /**
086             * The default behavior of this method is to return getCharacterEncoding()
087             * on the wrapped response object.
088             */
089
090            public String getCharacterEncoding() {
091                return this .response.getCharacterEncoding();
092            }
093
094            /**
095             * The default behavior of this method is to return getOutputStream()
096             * on the wrapped response object.
097             */
098
099            public ServletOutputStream getOutputStream() throws IOException {
100                return this .response.getOutputStream();
101            }
102
103            /**
104             * The default behavior of this method is to return getWriter()
105             * on the wrapped response object.
106             */
107
108            public PrintWriter getWriter() throws IOException {
109                return this .response.getWriter();
110            }
111
112            /**
113             * The default behavior of this method is to call setContentLength(int len)
114             * on the wrapped response object.
115             */
116
117            public void setContentLength(int len) {
118                this .response.setContentLength(len);
119            }
120
121            /**
122             * The default behavior of this method is to call setContentType(String type)
123             * on the wrapped response object.
124             */
125
126            public void setContentType(String type) {
127                this .response.setContentType(type);
128            }
129
130            /**
131             * The default behavior of this method is to return getContentType()
132             * on the wrapped response object.
133             *
134             * @since 2.4
135             */
136
137            public String getContentType() {
138                return this .response.getContentType();
139            }
140
141            /**
142             * The default behavior of this method is to call setBufferSize(int size)
143             * on the wrapped response object.
144             */
145            public void setBufferSize(int size) {
146                this .response.setBufferSize(size);
147            }
148
149            /**
150             * The default behavior of this method is to return getBufferSize()
151             * on the wrapped response object.
152             */
153            public int getBufferSize() {
154                return this .response.getBufferSize();
155            }
156
157            /**
158             * The default behavior of this method is to call flushBuffer()
159             * on the wrapped response object.
160             */
161
162            public void flushBuffer() throws IOException {
163                this .response.flushBuffer();
164            }
165
166            /**
167             * The default behavior of this method is to return isCommitted()
168             * on the wrapped response object.
169             */
170            public boolean isCommitted() {
171                return this .response.isCommitted();
172            }
173
174            /**
175             * The default behavior of this method is to call reset()
176             * on the wrapped response object.
177             */
178
179            public void reset() {
180                this .response.reset();
181            }
182
183            /**
184             * The default behavior of this method is to call resetBuffer()
185             * on the wrapped response object.
186             */
187
188            public void resetBuffer() {
189                this .response.resetBuffer();
190            }
191
192            /**
193             * The default behavior of this method is to call setLocale(Locale loc)
194             * on the wrapped response object.
195             */
196
197            public void setLocale(Locale loc) {
198                this .response.setLocale(loc);
199            }
200
201            /**
202             * The default behavior of this method is to return getLocale()
203             * on the wrapped response object.
204             */
205            public Locale getLocale() {
206                return this.response.getLocale();
207            }
208
209        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.