tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r697053 - in /tomcat/tc6.0.x/trunk: STATUS.txt conf/web.xml java/org/apache/catalina/servlets/DefaultServlet.java webapps/docs/changelog.xml webapps/docs/default-servlet.xml
Date Fri, 19 Sep 2008 11:12:13 GMT
Author: markt
Date: Fri Sep 19 04:12:13 2008
New Revision: 697053

URL: http://svn.apache.org/viewvc?rev=697053&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45419
Set Accept-Ranges for static resources served by DefaultServlet

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/conf/web.xml
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
    tomcat/tc6.0.x/trunk/webapps/docs/default-servlet.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=697053&r1=697052&r2=697053&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Sep 19 04:12:13 2008
@@ -159,12 +159,6 @@
   +1: markt, remm
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45419
-  Set Accept-Ranges for static resources served by DefaultServlet
-  http://svn.apache.org/viewvc?rev=696408&view=rev
-  +1: markt, remm, pero
-  -1: 
-
 * Allow asynchronous close() and setTimeout() on CometEvents
   http://svn.apache.org/viewvc?view=rev&revision=645175
   +1: fhanik

Modified: tomcat/tc6.0.x/trunk/conf/web.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/conf/web.xml?rev=697053&r1=697052&r2=697053&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/conf/web.xml (original)
+++ tomcat/tc6.0.x/trunk/conf/web.xml Fri Sep 19 04:12:13 2008
@@ -70,6 +70,9 @@
   <!--                       which sendfile will be used. Use a negative    -->
   <!--                       value to always disable sendfile.  [48]        -->
   <!--                                                                      -->
+  <!--   useAcceptRanges     Should the Accept-Ranges header be included    -->
+  <!--                       in responses where appropriate? [true]         -->
+  <!--                                                                      -->
   <!--  For directory listing customization. Checks localXsltFile, then     -->
   <!--  globalXsltFile, then defaults to original behavior.                 -->
   <!--                                                                      -->

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=697053&r1=697052&r2=697053&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Fri Sep 19
04:12:13 2008
@@ -154,7 +154,11 @@
      */
     protected int sendfileSize = 48 * 1024;
     
-    
+    /**
+     * Should the Accept-Ranges: bytes header be send with static resources?
+     */
+    protected boolean useAcceptRanges = true;
+
     /**
      * Full range marker.
      */
@@ -241,6 +245,9 @@
         localXsltFile = getServletConfig().getInitParameter("localXsltFile");
         readmeFile = getServletConfig().getInitParameter("readmeFile");
 
+        if (getServletConfig().getInitParameter("useAcceptRanges") != null)
+            useAcceptRanges = Boolean.parseBoolean(getServletConfig().getInitParameter("useAcceptRanges"));
+
         // Sanity check on the specified buffer sizes
         if (input < 256)
             input = 256;
@@ -717,9 +724,12 @@
             contentType = "text/html;charset=UTF-8";
 
         } else {
+            if (useAcceptRanges) {
+                // Accept ranges header
+                response.setHeader("Accept-Ranges", "bytes");
+            }
 
             // Parse range specifier
-
             ranges = parseRange(request, response, cacheEntry.attributes);
 
             // ETag header

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=697053&r1=697052&r2=697053&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Fri Sep 19 04:12:13 2008
@@ -44,6 +44,10 @@
         <bug>41407</bug>: Add CLIENT-CERT support to the JAAS Realm. (markt)
       </add>
       <fix>
+        <bug>45419</bug>: Set Accept-Ranges for static resources served by
+        DefaultServlet. (markt)
+      </fix>
+      <fix>
         <bug>45441</bug>: Correctly map filters for FORWARD and INCLUDE. (markt)
       </fix>
       <fix>

Modified: tomcat/tc6.0.x/trunk/webapps/docs/default-servlet.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/default-servlet.xml?rev=697053&r1=697052&r2=697053&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/default-servlet.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/default-servlet.xml Fri Sep 19 04:12:13 2008
@@ -179,6 +179,13 @@
         to always disable sendfile. [48]
     </td>
   </tr>
+  <tr>
+    <th valign='top'>useAcceptRanges</th>
+    <td valign='top'>
+        If true, the Accept-Ranges header will be set when appropriate for the
+        response. [true]
+    </td>
+  </tr>
 
 </table>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message