Produced by Araxis Merge on 2016-08-05 09:21:32 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Merge Test Files/jakarta-tomcat-4.0.6-src/catalina/src/share/org/apache/catalina/connector/http | HttpResponseImpl.java | 2002-10-08 14:15:36 +0000 |
| 2 | /Merge Test Files/jakarta-tomcat-4.1.18-src/catalina/src/share/org/apache/catalina/connector/http | HttpResponseImpl.java | 2002-12-19 13:49:40 +0000 |
| 3 | /Merge Test Files/jakarta-tomcat-4.1.24-src/catalina/src/share/org/apache/catalina/connector/http | HttpResponseImpl.java | 2003-03-19 09:18:36 +0000 |
| Note: Merge considers the second file to be the common ancestor of the others. | |||
| Description | Between Files 1 and 2 | Between Files 2 and 3 | Relative to Common Ancestor | |||
|---|---|---|---|---|---|---|
| Text Blocks | Lines | Text Blocks | Lines | Text Blocks | Lines | |
| Unchanged | 3 | 654 | 1 | 664 | ||
| Changed | 2 | 9 | 0 | 0 | 2 | 9 |
| Inserted | 0 | 0 | 0 | 0 | 0 | 0 |
| Removed | 0 | 0 | 0 | 0 | 0 | 0 |
| Note: An automatic merge would leave 0 conflict(s). | ||||||
| Whitespace | Differences in whitespace are significant |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are significant |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /* | 1 | /* | 1 | /* | |||||
| 2 | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v 1.11.2.1 2002/02/21 | 2 | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v 1.13 2002/03/ | 2 | * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpResponseImpl.java,v 1.13 2002/03/18 07:15:40 remm Exp $ | |||||
| 3 | * $Revision: 1.11.2.1 $ | 3 | * $Revision: 1.13 $ | 3 | * $Revision: 1.13 $ | |||||
| 4 | * $Date: 2002/02/21 | 4 | * $Date: 2002/03/ | 4 | * $Date: 2002/03/18 07:15:40 $ | |||||
| 5 | * | 5 | * | 5 | * | |||||
| 6 | * ==================================================================== | 6 | * ==================================================================== | 6 | * ==================================================================== | |||||
| 7 | * | 7 | * | 7 | * | |||||
| 8 | * The Apache Software License, Version 1.1 | 8 | * The Apache Software License, Version 1.1 | 8 | * The Apache Software License, Version 1.1 | |||||
| 9 | * | 9 | * | 9 | * | |||||
| 10 | * Copyright (c) 1999 The Apache Software Foundation. All rights | 10 | * Copyright (c) 1999 The Apache Software Foundation. All rights | 10 | * Copyright (c) 1999 The Apache Software Foundation. All rights | |||||
| 11 | * reserved. | 11 | * reserved. | 11 | * reserved. | |||||
| 12 | * | 12 | * | 12 | * | |||||
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |||||
| 14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |||||
| 15 | * are met: | 15 | * are met: | 15 | * are met: | |||||
| 16 | * | 16 | * | 16 | * | |||||
| 17 | * 1. Redistributions of source code must retain the above copyright | 17 | * 1. Redistributions of source code must retain the above copyright | 17 | * 1. Redistributions of source code must retain the above copyright | |||||
| 18 | * notice, this list of conditions and the following disclaimer. | 18 | * notice, this list of conditions and the following disclaimer. | 18 | * notice, this list of conditions and the following disclaimer. | |||||
| 19 | * | 19 | * | 19 | * | |||||
| 20 | * 2. Redistributions in binary form must reproduce the above copyright | 20 | * 2. Redistributions in binary form must reproduce the above copyright | 20 | * 2. Redistributions in binary form must reproduce the above copyright | |||||
| 21 | * notice, this list of conditions and the following disclaimer in | 21 | * notice, this list of conditions and the following disclaimer in | 21 | * notice, this list of conditions and the following disclaimer in | |||||
| 22 | * the documentation and/or other materials provided with the | 22 | * the documentation and/or other materials provided with the | 22 | * the documentation and/or other materials provided with the | |||||
| 23 | * distribution. | 23 | * distribution. | 23 | * distribution. | |||||
| 24 | * | 24 | * | 24 | * | |||||
| 25 | * 3. The end-user documentation included with the redistribution, if | 25 | * 3. The end-user documentation included with the redistribution, if | 25 | * 3. The end-user documentation included with the redistribution, if | |||||
| 26 | * any, must include the following acknowlegement: | 26 | * any, must include the following acknowlegement: | 26 | * any, must include the following acknowlegement: | |||||
| 27 | * "This product includes software developed by the | 27 | * "This product includes software developed by the | 27 | * "This product includes software developed by the | |||||
| 28 | * Apache Software Foundation (http://www.apache.org/)." | 28 | * Apache Software Foundation (http://www.apache.org/)." | 28 | * Apache Software Foundation (http://www.apache.org/)." | |||||
| 29 | * Alternately, this acknowlegement may appear in the software itself, | 29 | * Alternately, this acknowlegement may appear in the software itself, | 29 | * Alternately, this acknowlegement may appear in the software itself, | |||||
| 30 | * if and wherever such third-party acknowlegements normally appear. | 30 | * if and wherever such third-party acknowlegements normally appear. | 30 | * if and wherever such third-party acknowlegements normally appear. | |||||
| 31 | * | 31 | * | 31 | * | |||||
| 32 | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | 32 | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | 32 | * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||||
| 33 | * Foundation" must not be used to endorse or promote products derived | 33 | * Foundation" must not be used to endorse or promote products derived | 33 | * Foundation" must not be used to endorse or promote products derived | |||||
| 34 | * from this software without prior written permission. For written | 34 | * from this software without prior written permission. For written | 34 | * from this software without prior written permission. For written | |||||
| 35 | * permission, please contact apache@apache.org. | 35 | * permission, please contact apache@apache.org. | 35 | * permission, please contact apache@apache.org. | |||||
| 36 | * | 36 | * | 36 | * | |||||
| 37 | * 5. Products derived from this software may not be called "Apache" | 37 | * 5. Products derived from this software may not be called "Apache" | 37 | * 5. Products derived from this software may not be called "Apache" | |||||
| 38 | * nor may "Apache" appear in their names without prior written | 38 | * nor may "Apache" appear in their names without prior written | 38 | * nor may "Apache" appear in their names without prior written | |||||
| 39 | * permission of the Apache Group. | 39 | * permission of the Apache Group. | 39 | * permission of the Apache Group. | |||||
| 40 | * | 40 | * | 40 | * | |||||
| 41 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | 41 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | 41 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| 42 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 42 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 42 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| 43 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 43 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 43 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| 44 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | 44 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | 44 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| 45 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 45 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 45 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| 47 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 47 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | 47 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| 48 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 48 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 48 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| 49 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 49 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 49 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| 50 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 50 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | 50 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| 51 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 51 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 51 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| 52 | * SUCH DAMAGE. | 52 | * SUCH DAMAGE. | 52 | * SUCH DAMAGE. | |||||
| 53 | * ==================================================================== | 53 | * ==================================================================== | 53 | * ==================================================================== | |||||
| 54 | * | 54 | * | 54 | * | |||||
| 55 | * This software consists of voluntary contributions made by many | 55 | * This software consists of voluntary contributions made by many | 55 | * This software consists of voluntary contributions made by many | |||||
| 56 | * individuals on behalf of the Apache Software Foundation. For more | 56 | * individuals on behalf of the Apache Software Foundation. For more | 56 | * individuals on behalf of the Apache Software Foundation. For more | |||||
| 57 | * information on the Apache Software Foundation, please see | 57 | * information on the Apache Software Foundation, please see | 57 | * information on the Apache Software Foundation, please see | |||||
| 58 | * <http://www.apache.org/>. | 58 | * <http://www.apache.org/>. | 58 | * <http://www.apache.org/>. | |||||
| 59 | * | 59 | * | 59 | * | |||||
| 60 | * [Additional notices, if required by prior licensing conditions] | 60 | * [Additional notices, if required by prior licensing conditions] | 60 | * [Additional notices, if required by prior licensing conditions] | |||||
| 61 | * | 61 | * | 61 | * | |||||
| 62 | */ | 62 | */ | 62 | */ | |||||
| 63 | 63 | 63 | ||||||||
| 64 | 64 | 64 | ||||||||
| 65 | package org.apache.catalina.connector.http; | 65 | package org.apache.catalina.connector.http; | 65 | package org.apache.catalina.connector.http; | |||||
| 66 | 66 | 66 | ||||||||
| 67 | 67 | 67 | ||||||||
| 68 | import java.io.IOException; | 68 | import java.io.IOException; | 68 | import java.io.IOException; | |||||
| 69 | import java.io.PrintWriter; | 69 | import java.io.PrintWriter; | 69 | import java.io.PrintWriter; | |||||
| 70 | import java.io.OutputStream; | 70 | import java.io.OutputStream; | 70 | import java.io.OutputStream; | |||||
| 71 | import java.util.ArrayList; | 71 | import java.util.ArrayList; | 71 | import java.util.ArrayList; | |||||
| 72 | import javax.servlet.ServletOutputStream; | 72 | import javax.servlet.ServletOutputStream; | 72 | import javax.servlet.ServletOutputStream; | |||||
| 73 | import javax.servlet.http.HttpServletResponse; | 73 | import javax.servlet.http.HttpServletResponse; | 73 | import javax.servlet.http.HttpServletResponse; | |||||
| 74 | import org.apache.catalina.connector.HttpResponseBase; | 74 | import org.apache.catalina.connector.HttpResponseBase; | 74 | import org.apache.catalina.connector.HttpResponseBase; | |||||
| 75 | 75 | 75 | ||||||||
| 76 | 76 | 76 | ||||||||
| 77 | /** | 77 | /** | 77 | /** | |||||
| 78 | * Implementation of <b>HttpResponse</b> specific to the HTTP connector. | 78 | * Implementation of <b>HttpResponse</b> specific to the HTTP connector. | 78 | * Implementation of <b>HttpResponse</b> specific to the HTTP connector. | |||||
| 79 | * | 79 | * | 79 | * | |||||
| 80 | * @author Craig R. McClanahan | 80 | * @author Craig R. McClanahan | 80 | * @author Craig R. McClanahan | |||||
| 81 | * @author <a href="mailto:remm@apache.org">Remy Maucherat</a> | 81 | * @author <a href="mailto:remm@apache.org">Remy Maucherat</a> | 81 | * @author <a href="mailto:remm@apache.org">Remy Maucherat</a> | |||||
| 82 | * @version $Revision: 1.11.2.1 $ $Date: 2002/02/21 | 82 | * @version $Revision: 1.13 $ $Date: 2002/03/ | 82 | * @version $Revision: 1.13 $ $Date: 2002/03/18 07:15:40 $ | |||||
| 83 | * @deprecated | 83 | * @deprecated | |||||||
| 83 | */ | 84 | */ | 84 | */ | |||||
| 84 | 85 | 85 | ||||||||
| 85 | final class HttpResponseImpl | 86 | final class HttpResponseImpl | 86 | final class HttpResponseImpl | |||||
| 86 | extends HttpResponseBase { | 87 | extends HttpResponseBase { | 87 | extends HttpResponseBase { | |||||
| 87 | 88 | 88 | ||||||||
| 88 | 89 | 89 | ||||||||
| 89 | // ----------------------------------------------------- Instance Variables | 90 | // ----------------------------------------------------- Instance Variables | 90 | // ----------------------------------------------------- Instance Variables | |||||
| 90 | 91 | 91 | ||||||||
| 91 | 92 | 92 | ||||||||
| 92 | /** | 93 | /** | 93 | /** | |||||
| 93 | * Descriptive information about this Response implementation. | 94 | * Descriptive information about this Response implementation. | 94 | * Descriptive information about this Response implementation. | |||||
| 94 | */ | 95 | */ | 95 | */ | |||||
| 95 | protected static final String info = | 96 | protected static final String info = | 96 | protected static final String info = | |||||
| 96 | "org.apache.catalina.connector.http.HttpResponseImpl/1.0"; | 97 | "org.apache.catalina.connector.http.HttpResponseImpl/1.0"; | 97 | "org.apache.catalina.connector.http.HttpResponseImpl/1.0"; | |||||
| 97 | 98 | 98 | ||||||||
| 98 | 99 | 99 | ||||||||
| 99 | /** | 100 | /** | 100 | /** | |||||
| 100 | * True if chunking is allowed. | 101 | * True if chunking is allowed. | 101 | * True if chunking is allowed. | |||||
| 101 | */ | 102 | */ | 102 | */ | |||||
| 102 | protected boolean allowChunking; | 103 | protected boolean allowChunking; | 103 | protected boolean allowChunking; | |||||
| 103 | 104 | 104 | ||||||||
| 104 | 105 | 105 | ||||||||
| 105 | /** | 106 | /** | 106 | /** | |||||
| 106 | * Associated HTTP response stream. | 107 | * Associated HTTP response stream. | 107 | * Associated HTTP response stream. | |||||
| 107 | */ | 108 | */ | 108 | */ | |||||
| 108 | protected HttpResponseStream responseStream; | 109 | protected HttpResponseStream responseStream; | 109 | protected HttpResponseStream responseStream; | |||||
| 109 | 110 | 110 | ||||||||
| 110 | 111 | 111 | ||||||||
| 111 | // ------------------------------------------------------------- Properties | 112 | // ------------------------------------------------------------- Properties | 112 | // ------------------------------------------------------------- Properties | |||||
| 112 | 113 | 113 | ||||||||
| 113 | 114 | 114 | ||||||||
| 114 | /** | 115 | /** | 115 | /** | |||||
| 115 | * Return descriptive information about this Response implementation and | 116 | * Return descriptive information about this Response implementation and | 116 | * Return descriptive information about this Response implementation and | |||||
| 116 | * the corresponding version number, in the format | 117 | * the corresponding version number, in the format | 117 | * the corresponding version number, in the format | |||||
| 117 | * <code><description>/<version></code>. | 118 | * <code><description>/<version></code>. | 118 | * <code><description>/<version></code>. | |||||
| 118 | */ | 119 | */ | 119 | */ | |||||
| 119 | public String getInfo() { | 120 | public String getInfo() { | 120 | public String getInfo() { | |||||
| 120 | 121 | 121 | ||||||||
| 121 | return (info); | 122 | return (info); | 122 | return (info); | |||||
| 122 | 123 | 123 | ||||||||
| 123 | } | 124 | } | 124 | } | |||||
| 124 | 125 | 125 | ||||||||
| 125 | 126 | 126 | ||||||||
| 126 | /** | 127 | /** | 127 | /** | |||||
| 127 | * Set the chunking flag. | 128 | * Set the chunking flag. | 128 | * Set the chunking flag. | |||||
| 128 | */ | 129 | */ | 129 | */ | |||||
| 129 | void setAllowChunking(boolean allowChunking) { | 130 | void setAllowChunking(boolean allowChunking) { | 130 | void setAllowChunking(boolean allowChunking) { | |||||
| 130 | this.allowChunking = allowChunking; | 131 | this.allowChunking = allowChunking; | 131 | this.allowChunking = allowChunking; | |||||
| 131 | } | 132 | } | 132 | } | |||||
| 132 | 133 | 133 | ||||||||
| 133 | 134 | 134 | ||||||||
| 134 | /** | 135 | /** | 135 | /** | |||||
| 135 | * True if chunking is allowed. | 136 | * True if chunking is allowed. | 136 | * True if chunking is allowed. | |||||
| 136 | */ | 137 | */ | 137 | */ | |||||
| 137 | public boolean isChunkingAllowed() { | 138 | public boolean isChunkingAllowed() { | 138 | public boolean isChunkingAllowed() { | |||||
| 138 | return allowChunking; | 139 | return allowChunking; | 139 | return allowChunking; | |||||
| 139 | } | 140 | } | 140 | } | |||||
| 140 | 141 | 141 | ||||||||
| 141 | 142 | 142 | ||||||||
| 142 | // ------------------------------------------------------ Protected Methods | 143 | // ------------------------------------------------------ Protected Methods | 143 | // ------------------------------------------------------ Protected Methods | |||||
| 143 | 144 | 144 | ||||||||
| 144 | /** | 145 | /** | 145 | /** | |||||
| 145 | * Return the HTTP protocol version implemented by this response | 146 | * Return the HTTP protocol version implemented by this response | 146 | * Return the HTTP protocol version implemented by this response | |||||
| 146 | * object. | 147 | * object. | 147 | * object. | |||||
| 147 | * | 148 | * | 148 | * | |||||
| 148 | * @return The "HTTP/1.1" string. | 149 | * @return The "HTTP/1.1" string. | 149 | * @return The "HTTP/1.1" string. | |||||
| 149 | */ | 150 | */ | 150 | */ | |||||
| 150 | protected String getProtocol() { | 151 | protected String getProtocol() { | 151 | protected String getProtocol() { | |||||
| 151 | return("HTTP/1.1"); | 152 | return("HTTP/1.1"); | 152 | return("HTTP/1.1"); | |||||
| 152 | } | 153 | } | 153 | } | |||||
| 153 | 154 | 154 | ||||||||
| 154 | 155 | 155 | ||||||||
| 155 | // --------------------------------------------------------- Public Methods | 156 | // --------------------------------------------------------- Public Methods | 156 | // --------------------------------------------------------- Public Methods | |||||
| 156 | 157 | 157 | ||||||||
| 157 | /** | 158 | /** | 158 | /** | |||||
| 158 | * Release all object references, and initialize instance variables, in | 159 | * Release all object references, and initialize instance variables, in | 159 | * Release all object references, and initialize instance variables, in | |||||
| 159 | * preparation for reuse of this object. | 160 | * preparation for reuse of this object. | 160 | * preparation for reuse of this object. | |||||
| 160 | */ | 161 | */ | 161 | */ | |||||
| 161 | public void recycle() { | 162 | public void recycle() { | 162 | public void recycle() { | |||||
| 162 | 163 | 163 | ||||||||
| 163 | super.recycle(); | 164 | super.recycle(); | 164 | super.recycle(); | |||||
| 164 | responseStream = null; | 165 | responseStream = null; | 165 | responseStream = null; | |||||
| 165 | allowChunking = false; | 166 | allowChunking = false; | 166 | allowChunking = false; | |||||
| 166 | 167 | 167 | ||||||||
| 167 | } | 168 | } | 168 | } | |||||
| 168 | 169 | 169 | ||||||||
| 169 | 170 | 170 | ||||||||
| 170 | /** | 171 | /** | 171 | /** | |||||
| 171 | * Send an error response with the specified status and message. | 172 | * Send an error response with the specified status and message. | 172 | * Send an error response with the specified status and message. | |||||
| 172 | * | 173 | * | 173 | * | |||||
| 173 | * @param status HTTP status code to send | 174 | * @param status HTTP status code to send | 174 | * @param status HTTP status code to send | |||||
| 174 | * @param message Corresponding message to send | 175 | * @param message Corresponding message to send | 175 | * @param message Corresponding message to send | |||||
| 175 | * | 176 | * | 176 | * | |||||
| 176 | * @exception IllegalStateException if this response has | 177 | * @exception IllegalStateException if this response has | 177 | * @exception IllegalStateException if this response has | |||||
| 177 | * already been committed | 178 | * already been committed | 178 | * already been committed | |||||
| 178 | * @exception IOException if an input/output error occurs | 179 | * @exception IOException if an input/output error occurs | 179 | * @exception IOException if an input/output error occurs | |||||
| 179 | */ | 180 | */ | 180 | */ | |||||
| 180 | public void sendError(int status, String message) throws IOException { | 181 | public void sendError(int status, String message) throws IOException { | 181 | public void sendError(int status, String message) throws IOException { | |||||
| 181 | 182 | 182 | ||||||||
| 182 | addHeader("Connection", "close"); | 183 | addHeader("Connection", "close"); | 183 | addHeader("Connection", "close"); | |||||
| 183 | super.sendError(status, message); | 184 | super.sendError(status, message); | 184 | super.sendError(status, message); | |||||
| 184 | 185 | 185 | ||||||||
| 185 | } | 186 | } | 186 | } | |||||
| 186 | 187 | 187 | ||||||||
| 187 | 188 | 188 | ||||||||
| 188 | /** | 189 | /** | 189 | /** | |||||
| 189 | * Clear any content written to the buffer. In addition, all cookies | 190 | * Clear any content written to the buffer. In addition, all cookies | 190 | * Clear any content written to the buffer. In addition, all cookies | |||||
| 190 | * and headers are cleared, and the status is reset. | 191 | * and headers are cleared, and the status is reset. | 191 | * and headers are cleared, and the status is reset. | |||||
| 191 | * | 192 | * | 192 | * | |||||
| 192 | * @exception IllegalStateException if this response has already | 193 | * @exception IllegalStateException if this response has already | 193 | * @exception IllegalStateException if this response has already | |||||
| 193 | * been committed | 194 | * been committed | 194 | * been committed | |||||
| 194 | */ | 195 | */ | 195 | */ | |||||
| 195 | public void reset() { | 196 | public void reset() { | 196 | public void reset() { | |||||
| 196 | 197 | 197 | ||||||||
| 197 | // Saving important HTTP/1.1 specific headers | 198 | // Saving important HTTP/1.1 specific headers | 198 | // Saving important HTTP/1.1 specific headers | |||||
| 198 | String connectionValue = | 199 | String connectionValue = | 199 | String connectionValue = | |||||
| 199 | (String) getHeader("Connection"); | 200 | (String) getHeader("Connection"); | 200 | (String) getHeader("Connection"); | |||||
| 200 | String transferEncodingValue = | 201 | String transferEncodingValue = | 201 | String transferEncodingValue = | |||||
| 201 | (String) getHeader("Transfer-Encoding"); | 202 | (String) getHeader("Transfer-Encoding"); | 202 | (String) getHeader("Transfer-Encoding"); | |||||
| 202 | super.reset(); | 203 | super.reset(); | 203 | super.reset(); | |||||
| 203 | if (connectionValue != null) | 204 | if (connectionValue != null) | 204 | if (connectionValue != null) | |||||
| 204 | addHeader("Connection", connectionValue); | 205 | addHeader("Connection", connectionValue); | 205 | addHeader("Connection", connectionValue); | |||||
| 205 | if (transferEncodingValue != null) | 206 | if (transferEncodingValue != null) | 206 | if (transferEncodingValue != null) | |||||
| 206 | addHeader("Transfer-Encoding", transferEncodingValue); | 207 | addHeader("Transfer-Encoding", transferEncodingValue); | 207 | addHeader("Transfer-Encoding", transferEncodingValue); | |||||
| 207 | 208 | 208 | ||||||||
| 208 | } | 209 | } | 209 | } | |||||
| 209 | 210 | 210 | ||||||||
| 210 | 211 | 211 | ||||||||
| 211 | /** | 212 | /** | 212 | /** | |||||
| 212 | * Create and return a ServletOutputStream to write the content | 213 | * Create and return a ServletOutputStream to write the content | 213 | * Create and return a ServletOutputStream to write the content | |||||
| 213 | * associated with this Response. | 214 | * associated with this Response. | 214 | * associated with this Response. | |||||
| 214 | * | 215 | * | 215 | * | |||||
| 215 | * @exception IOException if an input/output error occurs | 216 | * @exception IOException if an input/output error occurs | 216 | * @exception IOException if an input/output error occurs | |||||
| 216 | */ | 217 | */ | 217 | */ | |||||
| 217 | public ServletOutputStream createOutputStream() throws IOException { | 218 | public ServletOutputStream createOutputStream() throws IOException { | 218 | public ServletOutputStream createOutputStream() throws IOException { | |||||
| 218 | 219 | 219 | ||||||||
| 219 | responseStream = new HttpResponseStream(this); | 220 | responseStream = new HttpResponseStream(this); | 220 | responseStream = new HttpResponseStream(this); | |||||
| 220 | return (responseStream); | 221 | return (responseStream); | 221 | return (responseStream); | |||||
| 221 | 222 | 222 | ||||||||
| 222 | } | 223 | } | 223 | } | |||||
| 223 | 224 | 224 | ||||||||
| 224 | 225 | 225 | ||||||||
| 225 | /** | 226 | /** | 226 | /** | |||||
| 226 | * Tests is the connection will be closed after the processing of the | 227 | * Tests is the connection will be closed after the processing of the | 227 | * Tests is the connection will be closed after the processing of the | |||||
| 227 | * request. | 228 | * request. | 228 | * request. | |||||
| 228 | */ | 229 | */ | 229 | */ | |||||
| 229 | public boolean isCloseConnection() { | 230 | public boolean isCloseConnection() { | 230 | public boolean isCloseConnection() { | |||||
| 230 | String connectionValue = (String) getHeader("Connection"); | 231 | String connectionValue = (String) getHeader("Connection"); | 231 | String connectionValue = (String) getHeader("Connection"); | |||||
| 231 | return (connectionValue != null | 232 | return (connectionValue != null | 232 | return (connectionValue != null | |||||
| 232 | && connectionValue.equals("close")); | 233 | && connectionValue.equals("close")); | 233 | && connectionValue.equals("close")); | |||||
| 233 | } | 234 | } | 234 | } | |||||
| 234 | 235 | 235 | ||||||||
| 235 | 236 | 236 | ||||||||
| 236 | /** | 237 | /** | 237 | /** | |||||
| 237 | * Removes the specified header. | 238 | * Removes the specified header. | 238 | * Removes the specified header. | |||||
| 238 | * | 239 | * | 239 | * | |||||
| 239 | * @param name Name of the header to remove | 240 | * @param name Name of the header to remove | 240 | * @param name Name of the header to remove | |||||
| 240 | * @param value Value to remove | 241 | * @param value Value to remove | 241 | * @param value Value to remove | |||||
| 241 | */ | 242 | */ | 242 | */ | |||||
| 242 | public void removeHeader(String name, String value) { | 243 | public void removeHeader(String name, String value) { | 243 | public void removeHeader(String name, String value) { | |||||
| 243 | 244 | 244 | ||||||||
| 244 | if (isCommitted()) | 245 | if (isCommitted()) | 245 | if (isCommitted()) | |||||
| 245 | return; | 246 | return; | 246 | return; | |||||
| 246 | 247 | 247 | ||||||||
| 247 | if (included) | 248 | if (included) | 248 | if (included) | |||||
| 248 | return; // Ignore any call from an included servlet | 249 | return; // Ignore any call from an included servlet | 249 | return; // Ignore any call from an included servlet | |||||
| 249 | 250 | 250 | ||||||||
| 250 | synchronized (headers) { | 251 | synchronized (headers) { | 251 | synchronized (headers) { | |||||
| 251 | ArrayList values = (ArrayList) headers.get(name); | 252 | ArrayList values = (ArrayList) headers.get(name); | 252 | ArrayList values = (ArrayList) headers.get(name); | |||||
| 252 | if ((values != null) && (!values.isEmpty())) { | 253 | if ((values != null) && (!values.isEmpty())) { | 253 | if ((values != null) && (!values.isEmpty())) { | |||||
| 253 | values.remove(value); | 254 | values.remove(value); | 254 | values.remove(value); | |||||
| 254 | if (values.isEmpty()) | 255 | if (values.isEmpty()) | 255 | if (values.isEmpty()) | |||||
| 255 | headers.remove(name); | 256 | headers.remove(name); | 256 | headers.remove(name); | |||||
| 256 | } | 257 | } | 257 | } | |||||
| 257 | } | 258 | } | 258 | } | |||||
| 258 | 259 | 259 | ||||||||
| 259 | } | 260 | } | 260 | } | |||||
| 260 | 261 | 261 | ||||||||
| 261 | 262 | 262 | ||||||||
| 262 | /** | 263 | /** | 263 | /** | |||||
| 263 | * Has stream been created ? | 264 | * Has stream been created ? | 264 | * Has stream been created ? | |||||
| 264 | */ | 265 | */ | 265 | */ | |||||
| 265 | public boolean isStreamInitialized() { | 266 | public boolean isStreamInitialized() { | 266 | public boolean isStreamInitialized() { | |||||
| 266 | return (responseStream != null); | 267 | return (responseStream != null); | 267 | return (responseStream != null); | |||||
| 267 | } | 268 | } | 268 | } | |||||
| 268 | 269 | 269 | ||||||||
| 269 | 270 | 270 | ||||||||
| 270 | /** | 271 | /** | 271 | /** | |||||
| 271 | * Perform whatever actions are required to flush and close the output | 272 | * Perform whatever actions are required to flush and close the output | 272 | * Perform whatever actions are required to flush and close the output | |||||
| 272 | * stream or writer, in a single operation. | 273 | * stream or writer, in a single operation. | 273 | * stream or writer, in a single operation. | |||||
| 273 | * | 274 | * | 274 | * | |||||
| 274 | * @exception IOException if an input/output error occurs | 275 | * @exception IOException if an input/output error occurs | 275 | * @exception IOException if an input/output error occurs | |||||
| 275 | */ | 276 | */ | 276 | */ | |||||
| 276 | public void finishResponse() throws IOException { | 277 | public void finishResponse() throws IOException { | 277 | public void finishResponse() throws IOException { | |||||
| 277 | 278 | 278 | ||||||||
| 278 | if (getStatus() < HttpServletResponse.SC_BAD_REQUEST) { | 279 | if (getStatus() < HttpServletResponse.SC_BAD_REQUEST) { | 279 | if (getStatus() < HttpServletResponse.SC_BAD_REQUEST) { | |||||
| 279 | if ((!isStreamInitialized()) && (getContentLength() == -1) | 280 | if ((!isStreamInitialized()) && (getContentLength() == -1) | 280 | if ((!isStreamInitialized()) && (getContentLength() == -1) | |||||
| 280 | && (getStatus() >= 200) | 281 | && (getStatus() >= 200) | 281 | && (getStatus() >= 200) | |||||
| 281 | && (getStatus() != SC_NOT_MODIFIED) | 282 | && (getStatus() != SC_NOT_MODIFIED) | 282 | && (getStatus() != SC_NOT_MODIFIED) | |||||
| 282 | && (getStatus() != SC_NO_CONTENT)) | 283 | && (getStatus() != SC_NO_CONTENT)) | 283 | && (getStatus() != SC_NO_CONTENT)) | |||||
| 283 | setContentLength(0); | 284 | setContentLength(0); | 284 | setContentLength(0); | |||||
| 284 | } else { | 285 | } else { | 285 | } else { | |||||
| 285 | setHeader("Connection", "close"); | 286 | setHeader("Connection", "close"); | 286 | setHeader("Connection", "close"); | |||||
| 286 | } | 287 | } | 287 | } | |||||
| 287 | super.finishResponse(); | 288 | super.finishResponse(); | 288 | super.finishResponse(); | |||||
| 288 | 289 | 289 | ||||||||
| 289 | } | 290 | } | 290 | } | |||||
| 290 | 291 | 291 | ||||||||
| 291 | 292 | 292 | ||||||||
| 292 | // -------------------------------------------- HttpServletResponse Methods | 293 | // -------------------------------------------- HttpServletResponse Methods | 293 | // -------------------------------------------- HttpServletResponse Methods | |||||
| 293 | 294 | 294 | ||||||||
| 294 | 295 | 295 | ||||||||
| 295 | /** | 296 | /** | 296 | /** | |||||
| 296 | * Set the HTTP status to be returned with this response. | 297 | * Set the HTTP status to be returned with this response. | 297 | * Set the HTTP status to be returned with this response. | |||||
| 297 | * | 298 | * | 298 | * | |||||
| 298 | * @param status The new HTTP status | 299 | * @param status The new HTTP status | 299 | * @param status The new HTTP status | |||||
| 299 | */ | 300 | */ | 300 | */ | |||||
| 300 | public void setStatus(int status) { | 301 | public void setStatus(int status) { | 301 | public void setStatus(int status) { | |||||
| 301 | 302 | 302 | ||||||||
| 302 | super.setStatus(status); | 303 | super.setStatus(status); | 303 | super.setStatus(status); | |||||
| 303 | 304 | 304 | ||||||||
| 304 | if (responseStream != null) | 305 | if (responseStream != null) | 305 | if (responseStream != null) | |||||
| 305 | responseStream.checkChunking(this); | 306 | responseStream.checkChunking(this); | 306 | responseStream.checkChunking(this); | |||||
| 306 | 307 | 307 | ||||||||
| 307 | } | 308 | } | 308 | } | |||||
| 308 | 309 | 309 | ||||||||
| 309 | 310 | 310 | ||||||||
| 310 | /** | 311 | /** | 311 | /** | |||||
| 311 | * Set the content length (in bytes) for this Response. | 312 | * Set the content length (in bytes) for this Response. | 312 | * Set the content length (in bytes) for this Response. | |||||
| 312 | * | 313 | * | 313 | * | |||||
| 313 | * @param length The new content length | 314 | * @param length The new content length | 314 | * @param length The new content length | |||||
| 314 | */ | 315 | */ | 315 | */ | |||||
| 315 | public void setContentLength(int length) { | 316 | public void setContentLength(int length) { | 316 | public void setContentLength(int length) { | |||||
| 316 | 317 | 317 | ||||||||
| 317 | if (isCommitted()) | 318 | if (isCommitted()) | 318 | if (isCommitted()) | |||||
| 318 | return; | 319 | return; | 319 | return; | |||||
| 319 | 320 | 320 | ||||||||
| 320 | if (included) | 321 | if (included) | 321 | if (included) | |||||
| 321 | return; // Ignore any call from an included servlet | 322 | return; // Ignore any call from an included servlet | 322 | return; // Ignore any call from an included servlet | |||||
| 322 | 323 | 323 | ||||||||
| 323 | super.setContentLength(length); | 324 | super.setContentLength(length); | 324 | super.setContentLength(length); | |||||
| 324 | 325 | 325 | ||||||||
| 325 | if (responseStream != null) | 326 | if (responseStream != null) | 326 | if (responseStream != null) | |||||
| 326 | responseStream.checkChunking(this); | 327 | responseStream.checkChunking(this); | 327 | responseStream.checkChunking(this); | |||||
| 327 | 328 | 328 | ||||||||
| 328 | } | 329 | } | 329 | } | |||||
| 329 | 330 | 330 | ||||||||
| 330 | 331 | 331 | ||||||||
| 331 | } | 332 | } | 332 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.