Author: markt
Date: Wed Mar 19 15:56:26 2008
New Revision: 639049

URL: http://svn.apache.org/viewvc?rev=639049&view=rev
Log:
Fix bug 44562. HEAD requests cannot use includes. Patch provided by David 
Jencks.

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/javax/servlet/http/HttpServlet.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=639049&r1=639048&r2=639049&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Mar 19 15:56:26 2008
@@ -94,12 +94,6 @@
   +1 : fhanik - I don't think we should support mark/reset, we can supply a 
filter that does it at the app level by wrapping getReader with a reader that 
bufferes
   -1 : 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44562
-  http://svn.apache.org/viewvc?rev=635294&view=rev (prior code clean up)
-  http://svn.apache.org/viewvc?rev=635297&view=rev (the actual fix)
-  +1: markt, remm, jfclere
-  -1:
-
 * Fix minor HttpServlet bug. Use localised error message.
   http://svn.apache.org/viewvc?rev=635298&view=rev
   +1: markt, remm, fhanik

Modified: tomcat/tc6.0.x/trunk/java/javax/servlet/http/HttpServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/javax/servlet/http/HttpServlet.java?rev=639049&r1=639048&r2=639049&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/javax/servlet/http/HttpServlet.java (original)
+++ tomcat/tc6.0.x/trunk/java/javax/servlet/http/HttpServlet.java Wed Mar 19 
15:56:26 2008
@@ -23,7 +23,6 @@
 import java.lang.reflect.Method;
 import java.text.MessageFormat;
 import java.util.Enumeration;
-import java.util.Locale;
 import java.util.ResourceBundle;
 
 import javax.servlet.GenericServlet;
@@ -721,155 +720,51 @@
 
 
 /*
- * A response that includes no body, for use in (dumb) "HEAD" support.
+ * A response wrapper for use in (dumb) "HEAD" support.
  * This just swallows that body, counting the bytes in order to set
- * the content length appropriately.  All other methods delegate directly
- * to the HTTP Servlet Response object used to construct this one.
+ * the content length appropriately.  All other methods delegate to the
+ * wrapped HTTP Servlet Response object.
  */
 // file private
-class NoBodyResponse implements HttpServletResponse {
-    private HttpServletResponse                resp;
+class NoBodyResponse extends HttpServletResponseWrapper {
     private NoBodyOutputStream                noBody;
     private PrintWriter                        writer;
     private boolean                        didSetContentLength;
 
     // file private
     NoBodyResponse(HttpServletResponse r) {
-        resp = r;
+        super(r);
         noBody = new NoBodyOutputStream();
     }
 
     // file private
     void setContentLength() {
         if (!didSetContentLength)
-          resp.setContentLength(noBody.getContentLength());
+          super.setContentLength(noBody.getContentLength());
     }
 
 
     // SERVLET RESPONSE interface methods
 
     public void setContentLength(int len) {
-        resp.setContentLength(len);
+        super.setContentLength(len);
         didSetContentLength = true;
     }
 
-    public void setCharacterEncoding(String charset)
-      { resp.setCharacterEncoding(charset); }
-
-    public void setContentType(String type)
-      { resp.setContentType(type); }
-
-    public String getContentType()
-      { return resp.getContentType(); }
-
-    public ServletOutputStream getOutputStream() throws IOException
-      { return noBody; }
+    public ServletOutputStream getOutputStream() throws IOException {
+        return noBody;
+    }
 
-    public String getCharacterEncoding()
-        { return resp.getCharacterEncoding(); }
+    public PrintWriter getWriter() throws UnsupportedEncodingException {
 
-    public PrintWriter getWriter() throws UnsupportedEncodingException
-    {
         if (writer == null) {
-            OutputStreamWriter        w;
+            OutputStreamWriter w;
 
             w = new OutputStreamWriter(noBody, getCharacterEncoding());
             writer = new PrintWriter(w);
         }
         return writer;
     }
-
-    public void setBufferSize(int size) throws IllegalStateException
-      { resp.setBufferSize(size); }
-
-    public int getBufferSize()
-      { return resp.getBufferSize(); }
-
-    public void reset() throws IllegalStateException
-      { resp.reset(); }
-      
-      public void resetBuffer() throws IllegalStateException
-      { resp.resetBuffer(); }
-
-    public boolean isCommitted()
-      { return resp.isCommitted(); }
-
-    public void flushBuffer() throws IOException
-      { resp.flushBuffer(); }
-
-    public void setLocale(Locale loc)
-      { resp.setLocale(loc); }
-
-    public Locale getLocale()
-      { return resp.getLocale(); }
-
-
-    // HTTP SERVLET RESPONSE interface methods
-
-    public void addCookie(Cookie cookie)
-      { resp.addCookie(cookie); }
-
-    public boolean containsHeader(String name)
-      { return resp.containsHeader(name); }
-
-    /** @deprecated */
-    public void setStatus(int sc, String sm)
-      { resp.setStatus(sc, sm); }
-
-    public void setStatus(int sc)
-      { resp.setStatus(sc); }
-
-    public void setHeader(String name, String value)
-      { resp.setHeader(name, value); }
-
-    public void setIntHeader(String name, int value)
-      { resp.setIntHeader(name, value); }
-
-    public void setDateHeader(String name, long date)
-      { resp.setDateHeader(name, date); }
-
-    public void sendError(int sc, String msg) throws IOException
-      { resp.sendError(sc, msg); }
-
-    public void sendError(int sc) throws IOException
-      { resp.sendError(sc); }
-
-    public void sendRedirect(String location) throws IOException
-      { resp.sendRedirect(location); }
-    
-    public String encodeURL(String url) 
-      { return resp.encodeURL(url); }
-
-    public String encodeRedirectURL(String url)
-      { return resp.encodeRedirectURL(url); }
-      
-    public void addHeader(String name, String value)
-      { resp.addHeader(name, value); }
-      
-    public void addDateHeader(String name, long value)
-      { resp.addDateHeader(name, value); }
-      
-    public void addIntHeader(String name, int value)
-      { resp.addIntHeader(name, value); }
-      
-
-    /**
-     * @deprecated        As of Version 2.1, replaced by
-     *                         [EMAIL PROTECTED] 
HttpServletResponse#encodeURL}.
-     *
-     */
-    public String encodeUrl(String url) 
-      { return this.encodeURL(url); }
-      
-
-    /**
-     * @deprecated        As of Version 2.1, replaced by
-     *                        [EMAIL PROTECTED] 
HttpServletResponse#encodeRedirectURL}.
-     *
-     */
-    public String encodeRedirectUrl(String url)
-      { return this.encodeRedirectURL(url); }
-
 }
 
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=639049&r1=639048&r2=639049&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Mar 19 15:56:26 2008
@@ -52,6 +52,10 @@
       <fix>
         Fix NPE when iterating through sessions for expiration. (fhanik/jim)
       </fix>
+      <fix>
+        <bug>44562</bug>: HEAD requests cannot use includes. Patch provided by
+        David Jencks. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to