Source Code Cross Referenced for HttpResponse.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » environment » http » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.environment.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.environment.http;
018:
019:        import org.apache.cocoon.environment.Cookie;
020:        import org.apache.cocoon.environment.Response;
021:
022:        import javax.servlet.ServletOutputStream;
023:        import javax.servlet.http.HttpServletResponse;
024:        import java.io.IOException;
025:        import java.io.PrintWriter;
026:        import java.util.Locale;
027:
028:        /**
029:         * Implements the {@link org.apache.cocoon.environment.Response} interface
030:         * to provide response functionality in the HTTP servlets environment.
031:         * 
032:         * @author <a href="mailto:dev@cocoon.apache.org">Apache Cocoon Team</a>
033:         * @version CVS $Id: HttpResponse.java 433543 2006-08-22 06:22:54Z crossley $
034:         */
035:
036:        public final class HttpResponse implements  Response {
037:
038:            /** The real HttpServletResponse object */
039:            private final HttpServletResponse res;
040:
041:            /**
042:             * Creates a HttpServletResponse based on a real HttpServletResponse object
043:             */
044:            protected HttpResponse(HttpServletResponse res) {
045:                this .res = res;
046:            }
047:
048:            /**
049:             * Create a new cookie which is not added to the response
050:             */
051:            public Cookie createCookie(String name, String value) {
052:                return new HttpCookie(name, value);
053:            }
054:
055:            public void addCookie(Cookie cookie) {
056:                if (cookie instanceof  HttpCookie) {
057:                    this .res
058:                            .addCookie(((HttpCookie) cookie).getServletCookie());
059:                } else {
060:                    javax.servlet.http.Cookie newCookie;
061:                    newCookie = new javax.servlet.http.Cookie(cookie.getName(),
062:                            cookie.getValue());
063:                    newCookie.setComment(cookie.getComment());
064:                    newCookie.setDomain(cookie.getDomain());
065:                    newCookie.setMaxAge(cookie.getMaxAge());
066:                    newCookie.setPath(cookie.getPath());
067:                    newCookie.setSecure(cookie.getSecure());
068:                    newCookie.setVersion(cookie.getVersion());
069:                    this .res.addCookie(newCookie);
070:                }
071:            }
072:
073:            public boolean containsHeader(String name) {
074:                return this .res.containsHeader(name);
075:            }
076:
077:            public String encodeURL(String url) {
078:                if (url != null && url.indexOf(";jsessionid=") != -1)
079:                    return url;
080:                return this .res.encodeURL(url);
081:            }
082:
083:            public String encodeRedirectURL(String url) {
084:                if (url != null && url.indexOf(";jsessionid=") != -1) {
085:                    return url;
086:                }
087:
088:                return this .res.encodeRedirectURL(url);
089:            }
090:
091:            public void sendError(int sc, String msg) throws IOException {
092:                this .res.sendError(sc, msg);
093:            }
094:
095:            public void sendError(int sc) throws IOException {
096:                this .res.sendError(sc);
097:            }
098:
099:            public void sendRedirect(String location) throws IOException {
100:                this .res.sendRedirect(location);
101:            }
102:
103:            public void sendPermanentRedirect(String location)
104:                    throws IOException {
105:                this .res.setHeader("location", location);
106:                this .res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
107:            }
108:
109:            public void setDateHeader(String name, long date) {
110:                this .res.setDateHeader(name, date);
111:            }
112:
113:            public void addDateHeader(String name, long date) {
114:                this .res.addDateHeader(name, date);
115:            }
116:
117:            public void setHeader(String name, String value) {
118:                this .res.setHeader(name, value);
119:            }
120:
121:            public void addHeader(String name, String value) {
122:                this .res.addHeader(name, value);
123:            }
124:
125:            public void setIntHeader(String name, int value) {
126:                this .res.setIntHeader(name, value);
127:            }
128:
129:            public void addIntHeader(String name, int value) {
130:                this .res.addIntHeader(name, value);
131:            }
132:
133:            public void setStatus(int sc) {
134:                this .res.setStatus(sc);
135:            }
136:
137:            /**
138:             * @deprecated        As of version 2.1, use encodeURL(String url) instead
139:             */
140:            public String encodeUrl(String url) {
141:                return this .res.encodeUrl(url);
142:            }
143:
144:            /**
145:             * @deprecated        As of version 2.1, use
146:             *              encodeRedirectURL(String url) instead
147:             */
148:            public String encodeRedirectUrl(String url) {
149:                return this .res.encodeRedirectUrl(url);
150:            }
151:
152:            /**
153:             * @deprecated As of version 2.1, due to ambiguous meaning of the
154:             * message parameter. To set a status code
155:             * use <code>setStatus(int)</code>, to send an error with a description
156:             * use <code>sendError(int, String)</code>.
157:             */
158:            public void setStatus(int sc, String sm) {
159:                this .res.setStatus(sc, sm);
160:            }
161:
162:            /* The ServletResponse interface methods */
163:
164:            public String getCharacterEncoding() {
165:                return this .res.getCharacterEncoding();
166:            }
167:
168:            public ServletOutputStream getOutputStream() throws IOException {
169:                //throw new IllegalStateException ("you are not a serializer or reader");
170:                return this .res.getOutputStream();
171:            }
172:
173:            public PrintWriter getWriter() throws IOException {
174:                //throw new IllegalStateException ("you are not a serializer or reader");
175:                return this .res.getWriter();
176:            }
177:
178:            public void setContentLength(int len) {
179:                this .res.setContentLength(len);
180:            }
181:
182:            public void setContentType(String type) {
183:                this .res.setContentType(type);
184:            }
185:
186:            public void setBufferSize(int size) {
187:                this .res.setBufferSize(size);
188:            }
189:
190:            public int getBufferSize() {
191:                return this .res.getBufferSize();
192:            }
193:
194:            public void flushBuffer() throws IOException {
195:                this .res.flushBuffer();
196:            }
197:
198:            public boolean isCommitted() {
199:                return this .res.isCommitted();
200:            }
201:
202:            public void reset() {
203:                this .res.reset();
204:            }
205:
206:            public void setLocale(Locale loc) {
207:                this .res.setLocale(loc);
208:            }
209:
210:            public Locale getLocale() {
211:                return this.res.getLocale();
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.