summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorThomas Becker2012-04-11 08:47:28 (EDT)
committer Thomas Becker2012-04-11 08:47:28 (EDT)
commit08573701efc447fb95da22bfc711f79b6908a60e (patch)
tree7354728308173d2076e79011bd0e67f37514a4f8
parent543d2a18caf3d10c2b3a91014d8fe93124ce7f69 (diff)
downloadorg.eclipse.jetty.project-08573701efc447fb95da22bfc711f79b6908a60e.zip
org.eclipse.jetty.project-08573701efc447fb95da22bfc711f79b6908a60e.tar.gz
org.eclipse.jetty.project-08573701efc447fb95da22bfc711f79b6908a60e.tar.bz2
376373: GzipFilter now does not ignore _excludePath + fix for ignored _excludeAgentPatterns if _excludeAgent is setrefs/changes/63/5563/1
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java6
-rw-r--r--jetty-servlets/src/test/java/org/eclipse/jetty/servlets/GzipFilterDefaultTest.java79
2 files changed, 42 insertions, 43 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java
index 94d50de..650632b 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java
@@ -303,7 +303,7 @@ public class GzipFilter extends UserAgentFilter
}
/**
- * Checks to see if the UserAgent is excluded
+ * Checks to see if the userAgent is excluded
*
* @param ua
* the user agent
@@ -336,9 +336,9 @@ public class GzipFilter extends UserAgentFilter
}
/**
- * Checks to see if the Path is excluded
+ * Checks to see if the path is excluded
*
- * @param ua
+ * @param requestURI
* the request uri
* @return boolean true if excluded
*/
diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/GzipFilterDefaultTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/GzipFilterDefaultTest.java
index 89f2f45..05f53c9 100644
--- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/GzipFilterDefaultTest.java
+++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/GzipFilterDefaultTest.java
@@ -31,11 +31,10 @@ public class GzipFilterDefaultTest
public static Collection<String[]> data()
{
String[][] data = new String[][]
- {
- { GzipFilter.GZIP },
- { GzipFilter.DEFLATE }
- };
-
+ {
+ { GzipFilter.GZIP },
+ { GzipFilter.DEFLATE } };
+
return Arrays.asList(data);
}
@@ -166,88 +165,88 @@ public class GzipFilterDefaultTest
@Test
public void testUserAgentExclusion() throws Exception
{
- GzipTester tester = new GzipTester(testingdir, compressionType);
-
+ GzipTester tester = new GzipTester(testingdir,compressionType);
+
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
- holder.setInitParameter("excludedAgents", "foo");
+ holder.setInitParameter("excludedAgents","foo");
tester.setUserAgent("foo");
-
+
int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
tester.prepareServerFile("file.txt",filesize);
-
+
try
{
tester.start();
- tester.assertIsResponseNotGzipCompressed("file.txt", filesize, HttpStatus.OK_200);
- }
+ tester.assertIsResponseNotGzipCompressed("file.txt",filesize,HttpStatus.OK_200);
+ }
finally
{
tester.stop();
}
}
-
+
@Test
public void testUserAgentExclusionByExcludedAgentPatterns() throws Exception
{
- GzipTester tester = new GzipTester(testingdir);
-
+ GzipTester tester = new GzipTester(testingdir,compressionType);
+
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
- holder.setInitParameter("excludedAgents", "bar");
- holder.setInitParameter("excludeAgentPatterns", "fo.*");
+ holder.setInitParameter("excludedAgents","bar");
+ holder.setInitParameter("excludeAgentPatterns","fo.*");
tester.setUserAgent("foo");
-
- int filesize = GzipResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
+
+ int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
tester.prepareServerFile("file.txt",filesize);
-
+
try
{
tester.start();
- tester.assertIsResponseNotGzipCompressed("file.txt", filesize, HttpStatus.OK_200);
- }
+ tester.assertIsResponseNotGzipCompressed("file.txt",filesize,HttpStatus.OK_200);
+ }
finally
{
tester.stop();
}
}
-
+
@Test
public void testExcludePaths() throws Exception
{
- GzipTester tester = new GzipTester(testingdir);
-
+ GzipTester tester = new GzipTester(testingdir,compressionType);
+
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
- holder.setInitParameter("excludePaths", "/context/");
-
- int filesize = GzipResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
+ holder.setInitParameter("excludePaths","/context/");
+
+ int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
tester.prepareServerFile("file.txt",filesize);
-
+
try
{
tester.start();
- tester.assertIsResponseNotGzipCompressed("file.txt", filesize, HttpStatus.OK_200);
- }
+ tester.assertIsResponseNotGzipCompressed("file.txt",filesize,HttpStatus.OK_200);
+ }
finally
{
tester.stop();
}
}
-
+
@Test
public void testExcludePathPatterns() throws Exception
{
- GzipTester tester = new GzipTester(testingdir);
-
+ GzipTester tester = new GzipTester(testingdir,compressionType);
+
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
- holder.setInitParameter("excludePathPatterns", "/cont.*");
-
- int filesize = GzipResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
+ holder.setInitParameter("excludePathPatterns","/cont.*");
+
+ int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
tester.prepareServerFile("file.txt",filesize);
-
+
try
{
tester.start();
- tester.assertIsResponseNotGzipCompressed("file.txt", filesize, HttpStatus.OK_200);
- }
+ tester.assertIsResponseNotGzipCompressed("file.txt",filesize,HttpStatus.OK_200);
+ }
finally
{
tester.stop();