Author: markt
Date: Thu Jun  5 15:27:16 2014
New Revision: 1600680

URL: http://svn.apache.org/r1600680
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56568
Allow JSP error pages to handle any HTTP method

Modified:
    tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java
    tomcat/trunk/test/org/apache/jasper/servlet/TestJspServlet.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java?rev=1600680&r1=1600679&r2=1600680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java Thu Jun  5 
15:27:16 2014
@@ -25,6 +25,7 @@ import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
+import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -283,8 +284,8 @@ public class JspServlet extends HttpServ
 
         String method = request.getMethod();
 
-        if (!"GET".equals(method) && !"POST".equals(method) &&
-                !"HEAD".equals(method)) {
+        if (!"GET".equals(method) && !"POST".equals(method) && 
!"HEAD".equals(method) &&
+                !DispatcherType.ERROR.equals(request.getDispatcherType())) {
             // Specification states behaviour is undefined
             // Jasper opts to reject any other verbs, partly as they are
             // unlikely to make sense in a JSP context and partly to protect

Modified: tomcat/trunk/test/org/apache/jasper/servlet/TestJspServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/servlet/TestJspServlet.java?rev=1600680&r1=1600679&r2=1600680&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/servlet/TestJspServlet.java (original)
+++ tomcat/trunk/test/org/apache/jasper/servlet/TestJspServlet.java Thu Jun  5 
15:27:16 2014
@@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.catalina.Context;
@@ -37,7 +36,6 @@ import org.apache.tomcat.util.descriptor
 public class TestJspServlet  extends TomcatBaseTest {
 
     @Test
-    @Ignore
     public void testBug56568() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1600680&r1=1600679&r2=1600680&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Jun  5 15:27:16 2014
@@ -181,6 +181,10 @@
         Correct a copy/paste error and return a 500 response rather than a 400
         response when an internal server error occurs. (markt)
       </fix>
+      <fix>
+        <bug>56568</bug>: Allow any HTTP method when a JSP is being used as an
+        error page. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">



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

Reply via email to