tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject tapestry-5 git commit: TAP5-2426: Enable gzip compression for svg files by default
Date Wed, 24 Dec 2014 01:15:49 GMT
Repository: tapestry-5
Updated Branches:
  refs/heads/master b62ddffd5 -> 989b7b224


TAP5-2426: Enable gzip compression for svg files by default


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/989b7b22
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/989b7b22
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/989b7b22

Branch: refs/heads/master
Commit: 989b7b22484ad1aab62b2d409289ac00d5aa3799
Parents: b62ddff
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Tue Dec 23 17:15:34 2014 -0800
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Tue Dec 23 17:15:34 2014 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/tapestry5/modules/AssetsModule.java  | 2 ++
 .../services/assets/CompressionAnalyzerImplTests.groovy       | 7 +++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/989b7b22/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java
index 4eab1ec..513f118 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java
@@ -217,6 +217,7 @@ public class AssetsModule
      * <li>image/jpeg</li>
      * <li>image/gif</li>
      * <li>image/png</li>
+     * <li>image/svg+xml</li>
      * <li>application/x-shockwave-flash</li>
      * <li>application/font-woff</li>
      * <li>application/x-font-ttf</li>
@@ -227,6 +228,7 @@ public class AssetsModule
     public void disableCompressionForImageTypes(MappedConfiguration<String, Boolean>
configuration)
     {
         configuration.add("image/*", false);
+        configuration.add("image/svg+xml", true);
         configuration.add("application/x-shockwave-flash", false);
         configuration.add("application/font-woff", false);
         configuration.add("application/x-font-ttf", false);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/989b7b22/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/assets/CompressionAnalyzerImplTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/assets/CompressionAnalyzerImplTests.groovy
b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/assets/CompressionAnalyzerImplTests.groovy
index 1de899a..bc6cfec 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/assets/CompressionAnalyzerImplTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/internal/services/assets/CompressionAnalyzerImplTests.groovy
@@ -38,4 +38,11 @@ class CompressionAnalyzerImplTests extends Assert  {
 
         assertEquals false, ca.isCompressable("image/png")
     }
+
+    @Test
+    void most_specific_match_wins() {
+        def ca = new CompressionAnalyzerImpl(["image/*": false, "image/svg" : true])
+
+        assertEquals true, ca.isCompressable("image/svg")
+    }
 }


Mime
View raw message