Fix IllegalStateException for JavaScript files
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 24 Jun 2011 12:48:20 +0000 (12:48 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 24 Jun 2011 12:48:20 +0000 (12:48 +0000)
when switching from Writer to OutputStream.

The special handling of this case in the
DefaultServlet was broken due to a MIME type
change for JavaScript.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1139280 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/servlets/DefaultServlet.java
webapps/docs/changelog.xml

index 0cb78bf..46210dc 100644 (file)
@@ -877,7 +877,8 @@ public class DefaultServlet
                 // trying to serve a text file
                 if ( (contentType == null)
                         || (contentType.startsWith("text"))
-                        || (contentType.endsWith("xml")) ) {
+                        || (contentType.endsWith("xml"))
+                        || (contentType.contains("/javascript")) ) {
                     writer = response.getWriter();
                     // Cannot reliably serve partial content with a Writer
                     ranges = FULL;
index 52df588..dec5430 100644 (file)
       <update>
         Improve JMX unit test. (rjung)
       </update>
+      <fix>
+        Fix IllegalStateException for JavaScript files when switching from
+        Writer to OutputStream. The special handling of this case in the
+        DefaultServlet was broken due to a MIME type change for JavaScript.
+        (funkman)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">