You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/02/10 23:42:15 UTC

svn commit: r1658827 - /tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java

Author: markt
Date: Tue Feb 10 22:42:15 2015
New Revision: 1658827

URL: http://svn.apache.org/r1658827
Log:
Add test case to confirm current behaviour re BZ 57559.

Modified:
    tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java

Modified: tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java?rev=1658827&r1=1658826&r2=1658827&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java (original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java Tue Feb 10 22:42:15 2015
@@ -2144,4 +2144,46 @@ public class TestAsyncContextImpl extend
             ac.dispatch(target);
          }
     }
+
+    // https://issues.apache.org/bugzilla/show_bug.cgi?id=57559
+    @Test
+    public void testAsyncRequestURI() throws Exception {
+        // Setup Tomcat instance
+        Tomcat tomcat = getTomcatInstance();
+
+        // No file system docBase required
+        Context ctx = tomcat.addContext("", null);
+
+        Servlet servlet = new AsyncRequestUriServlet();
+        Wrapper wrapper1 = Tomcat.addServlet(ctx, "bug57559", servlet);
+        wrapper1.setAsyncSupported(true);
+        ctx.addServletMapping("/", "bug57559");
+
+        tomcat.start();
+
+        String uri = "/foo/%24/bar";
+        String uriDecoded = "/foo/$/bar";
+
+        ByteChunk body = getUrl("http://localhost:" + getPort()+ uri);
+
+        Assert.assertEquals(uriDecoded, body.toString());
+    }
+
+    private static class AsyncRequestUriServlet extends HttpServlet {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+                throws ServletException, IOException {
+
+            if (DispatcherType.ASYNC.equals(req.getDispatcherType())) {
+                resp.setContentType("text/plain");
+                resp.setCharacterEncoding("UTF-8");
+                resp.getWriter().write(req.getRequestURI());
+            } else {
+                req.startAsync().dispatch();
+            }
+        }
+    }
 }



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