myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r1345504 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
Date Sat, 02 Jun 2012 12:46:58 GMT
Author: bommel
Date: Sat Jun  2 12:46:58 2012
New Revision: 1345504

URL: http://svn.apache.org/viewvc?rev=1345504&view=rev
Log:
(TOBAGO-945) Add the version of Tobago to the resources URL to avoid caching when updating
Tobago

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java?rev=1345504&r1=1345503&r2=1345504&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
Sat Jun  2 12:46:58 2012
@@ -34,6 +34,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -79,14 +80,11 @@ public class ResourceServlet extends Htt
     if (tobagoConfig != null && tobagoConfig.getProjectStage() == ProjectStage.Production)
{
        expires = 24 * 60 * 60 * 1000L;
     }
-    for (Theme theme : tobagoConfig.getSupportedThemes()) {
-      String dir = theme.getResourcePath();
-      if (dir.startsWith("/")) {
-        resourceDirs.add(dir.substring(1));
-      } else {
-        resourceDirs.add(dir);
-      }
-    }
+    Theme defaultTheme = tobagoConfig.getDefaultTheme();
+    addResourceDir(defaultTheme);
+    addResourceDir(defaultTheme.getFallbackList());
+    addResourceDir(tobagoConfig.getSupportedThemes());
+
     String expiresString = servletConfig.getInitParameter("expires");
     if (expiresString != null) {
       try {
@@ -106,7 +104,22 @@ public class ResourceServlet extends Htt
     }
   }
 
-  @Override
+  private void addResourceDir(List<Theme> themes) {
+    for (Theme theme : themes) {
+        addResourceDir(theme);
+    }
+  }
+
+  private void addResourceDir(Theme theme) {
+    String dir = theme.getResourcePath();
+    if (dir.startsWith("/")) {
+      resourceDirs.add(dir.substring(1));
+    } else {
+      resourceDirs.add(dir);
+    }
+  }
+
+    @Override
   protected void doGet(
       HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {



Mime
View raw message