Source Code Cross Referenced for ResponseFacade.java in  » Sevlet-Container » tomcat-catalina » org » apache » catalina » connector » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » tomcat catalina » org.apache.catalina.connector 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999,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:
017:        package org.apache.catalina.connector;
018:
019:        import java.io.IOException;
020:        import java.io.PrintWriter;
021:        import java.util.Locale;
022:
023:        import javax.servlet.ServletOutputStream;
024:        import javax.servlet.ServletResponse;
025:
026:        import org.apache.catalina.Response;
027:
028:        /**
029:         * Facade class that wraps a Catalina-internal <b>Response</b>
030:         * object.  All methods are delegated to the wrapped response.
031:         *
032:         * @author Remy Maucherat
033:         * @version $Revision: 1.5 $ $Date: 2004/02/27 14:58:41 $
034:         */
035:
036:        public class ResponseFacade implements  ServletResponse {
037:
038:            // ----------------------------------------------------------- Constructors
039:
040:            /**
041:             * Construct a wrapper for the specified response.
042:             *
043:             * @param response The response to be wrapped
044:             */
045:            public ResponseFacade(Response response) {
046:                this .resp = response;
047:                this .response = (ServletResponse) response;
048:            }
049:
050:            // ----------------------------------------------------- Instance Variables
051:
052:            /**
053:             * The wrapped response.
054:             */
055:            protected ServletResponse response = null;
056:
057:            /**
058:             * The wrapped response.
059:             */
060:            protected Response resp = null;
061:
062:            // --------------------------------------------------------- Public Methods
063:
064:            /**
065:             * Clear facade.
066:             */
067:            public void clear() {
068:                response = null;
069:                resp = null;
070:            }
071:
072:            public void finish() {
073:
074:                resp.setSuspended(true);
075:
076:            }
077:
078:            public boolean isFinished() {
079:
080:                return resp.isSuspended();
081:
082:            }
083:
084:            // ------------------------------------------------ ServletResponse Methods
085:
086:            public String getCharacterEncoding() {
087:                return response.getCharacterEncoding();
088:            }
089:
090:            public ServletOutputStream getOutputStream() throws IOException {
091:
092:                //        if (isFinished())
093:                //            throw new IllegalStateException
094:                //                (/*sm.getString("responseFacade.finished")*/);
095:
096:                ServletOutputStream sos = response.getOutputStream();
097:                if (isFinished())
098:                    resp.setSuspended(true);
099:                return (sos);
100:
101:            }
102:
103:            public PrintWriter getWriter() throws IOException {
104:
105:                //        if (isFinished())
106:                //            throw new IllegalStateException
107:                //                (/*sm.getString("responseFacade.finished")*/);
108:
109:                PrintWriter writer = response.getWriter();
110:                if (isFinished())
111:                    resp.setSuspended(true);
112:                return (writer);
113:
114:            }
115:
116:            public void setContentLength(int len) {
117:
118:                if (isCommitted())
119:                    return;
120:
121:                response.setContentLength(len);
122:
123:            }
124:
125:            public void setCharacterEncoding(String charset) {
126:
127:                if (isCommitted())
128:                    return;
129:
130:                response.setCharacterEncoding(charset);
131:
132:            }
133:
134:            public void setContentType(String type) {
135:
136:                if (isCommitted())
137:                    return;
138:
139:                response.setContentType(type);
140:
141:            }
142:
143:            public String getContentType() {
144:
145:                return response.getContentType();
146:
147:            }
148:
149:            public void setBufferSize(int size) {
150:
151:                if (isCommitted())
152:                    throw new IllegalStateException(/*sm.getString("responseBase.reset.ise")*/);
153:
154:                response.setBufferSize(size);
155:
156:            }
157:
158:            public int getBufferSize() {
159:                return response.getBufferSize();
160:            }
161:
162:            public void flushBuffer() throws IOException {
163:
164:                if (isFinished())
165:                    //            throw new IllegalStateException
166:                    //                (/*sm.getString("responseFacade.finished")*/);
167:                    return;
168:
169:                resp.setAppCommitted(true);
170:
171:                try {
172:                    response.flushBuffer();
173:                } catch (IOException ioe) {
174:                    // An IOException on a write is almost always due to
175:                    // the remote client aborting the request.  Wrap this
176:                    // so that it can be handled better by the error dispatcher.
177:                    throw new ClientAbortException(ioe);
178:                }
179:            }
180:
181:            public void resetBuffer() {
182:
183:                if (isCommitted())
184:                    throw new IllegalStateException(/*sm.getString("responseBase.reset.ise")*/);
185:
186:                response.resetBuffer();
187:
188:            }
189:
190:            public boolean isCommitted() {
191:                return (resp.isAppCommitted());
192:            }
193:
194:            public void reset() {
195:
196:                if (isCommitted())
197:                    throw new IllegalStateException(/*sm.getString("responseBase.reset.ise")*/);
198:
199:                response.reset();
200:
201:            }
202:
203:            public void setLocale(Locale loc) {
204:
205:                if (isCommitted())
206:                    return;
207:
208:                response.setLocale(loc);
209:            }
210:
211:            public Locale getLocale() {
212:                return response.getLocale();
213:            }
214:
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.