Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-02-18 22:13:39 +0000
committerGreg Wilkins2015-02-18 22:15:38 +0000
commit13040f300daa003381f9f8ca6a1b8dba9f5f13ac (patch)
tree24cfa206548296d3748fdfad7482d2d16bd914a0
parent73bd4c23ee9d05341cac4819c59d9816851a5bca (diff)
downloadorg.eclipse.jetty.project-13040f300daa003381f9f8ca6a1b8dba9f5f13ac.tar.gz
org.eclipse.jetty.project-13040f300daa003381f9f8ca6a1b8dba9f5f13ac.tar.xz
org.eclipse.jetty.project-13040f300daa003381f9f8ca6a1b8dba9f5f13ac.zip
460291 - AsyncGzipFilter Mappings
Added test harness to confirm mapping precidence
-rw-r--r--jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
index e7bda9c2ba..d9f706ee77 100644
--- a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
+++ b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
public class PathMapTest
{
@Test
- @Ignore
public void testPathMap() throws Exception
{
PathMap<String> p = new PathMap<>();
@@ -167,6 +166,30 @@ public class PathMapTest
assertNotMatch(spec, "/xyz?123"); // as if the ? was encoded and part of the path
}
+ @Test
+ public void testPrecidenceVsOrdering() throws Exception
+ {
+ PathMap<String> p = new PathMap<>();
+ p.put("/dump/gzip/*","prefix");
+ p.put("*.txt","suffix");
+
+ assertEquals(null,p.getMatch("/foo/bar"));
+ assertEquals("prefix",p.getMatch("/dump/gzip/something").getValue());
+ assertEquals("suffix",p.getMatch("/foo/something.txt").getValue());
+ assertEquals("prefix",p.getMatch("/dump/gzip/something.txt").getValue());
+
+ p = new PathMap<>();
+ p.put("*.txt","suffix");
+ p.put("/dump/gzip/*","prefix");
+
+ assertEquals(null,p.getMatch("/foo/bar"));
+ assertEquals("prefix",p.getMatch("/dump/gzip/something").getValue());
+ assertEquals("suffix",p.getMatch("/foo/something.txt").getValue());
+ assertEquals("prefix",p.getMatch("/dump/gzip/something.txt").getValue());
+ }
+
+
+
private void assertMatch(String spec, String path)
{
boolean match = PathMap.match(spec, path);

Back to the top