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 2010/10/06 17:09:37 UTC
svn commit: r1005076 -
/tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
Author: markt
Date: Wed Oct 6 15:09:37 2010
New Revision: 1005076
URL: http://svn.apache.org/viewvc?rev=1005076&view=rev
Log:
Colleague at $work reported issues path parameters and extension mapping so add some tests. Looks OK.
Modified:
tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
Modified: tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java?rev=1005076&r1=1005075&r2=1005076&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java (original)
+++ tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java Wed Oct 6 15:09:37 2010
@@ -130,4 +130,34 @@ public class TestCoyoteAdapter extends T
pw.write(sessionId);
}
}
+
+ public void testPathParamExtRootNoParam() throws Exception {
+ pathParamExtenionTest("/testapp/blah.txt", "none");
+ }
+
+ public void testPathParamExtLevel1NoParam() throws Exception {
+ pathParamExtenionTest("/testapp/blah/blah.txt", "none");
+ }
+
+ public void testPathParamExtLevel1WithParam() throws Exception {
+ pathParamExtenionTest("/testapp/blah;x=y/blah.txt", "none");
+ }
+
+ private void pathParamExtenionTest(String path, String expected)
+ throws Exception {
+ // Setup Tomcat instance
+ Tomcat tomcat = getTomcatInstance();
+
+ // Must have a real docBase - just use temp
+ Context ctx =
+ tomcat.addContext("/testapp", System.getProperty("java.io.tmpdir"));
+
+ Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
+ ctx.addServletMapping("*.txt", "servlet");
+
+ tomcat.start();
+
+ ByteChunk res = getUrl("http://localhost:" + getPort() + path);
+ assertEquals(expected, res.toString());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org