You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/03/31 16:20:01 UTC

svn commit: r524433 [1/4] - in /struts/struts2/trunk/plugins/dojo/src: main/java/org/apache/struts2/dojo/components/ main/java/org/apache/struts2/dojo/views/jsp/ui/ main/resources/org/apache/struts2/static/dojo/ main/resources/template/ajax/ test/java/...

Author: musachy
Date: Sat Mar 31 07:20:00 2007
New Revision: 524433

URL: http://svn.apache.org/viewvc?view=rev&rev=524433
Log:
WW-1536 Add a "cache" property to the head tag, that when true, uses an struts dojo profile, instead of standard dojo profile,
enabling the browser to catch the downloaded javascript files

Added:
    struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js
    struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
    struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-2.txt
Modified:
    struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
    struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
    struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/head.ftl
    struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest.java
    struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/HeadTagTest-1.txt

Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java?view=diff&rev=524433&r1=524432&r2=524433
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Head.java Sat Mar 31 07:20:00 2007
@@ -75,6 +75,7 @@
     private String baseRelativePath;
     private String extraLocales;
     private String locale;
+    private String cache;
     
     public Head(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
         super(stack, request, response);
@@ -99,6 +100,8 @@
         }
         if (this.locale != null)
             addParameter("locale", findString(this.locale));
+        if (this.cache != null)
+            addParameter("cache", findValue(this.cache, Boolean.class));
     }
 
     @Override
@@ -116,12 +119,12 @@
         return debug != null && Boolean.parseBoolean(debug);
     }
 
-    @StrutsTagAttribute(description="Set to true to enable Dojo debug messages", defaultValue="false")
+    @StrutsTagAttribute(description="Enable Dojo debug messages", defaultValue="false", type="Boolean")
     public void setDebug(String debug) {
         this.debug = debug;
     }
 
-    @StrutsTagAttribute(description="Use compressed version of dojo.js", defaultValue="true")
+    @StrutsTagAttribute(description="Use compressed version of dojo.js", defaultValue="true", type="Boolean")
     public void setCompressed(String compressed) {
         this.compressed = compressed;
     }
@@ -139,5 +142,11 @@
     @StrutsTagAttribute(description="Default locale to be used by Dojo, locale name must be specified as in RFC3066")
     public void setLocale(String locale) {
         this.locale = locale;
+    }
+
+    @StrutsTagAttribute(description="Use Struts Dojo profile, which contains all Struts widgets in one file, making it possible to be chached by " +
+                "the browser", defaultValue="true", type="Boolean")
+    public void setCache(String cache) {
+        this.cache = cache;
     }
 }

Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java?view=diff&rev=524433&r1=524432&r2=524433
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/HeadTag.java Sat Mar 31 07:20:00 2007
@@ -41,6 +41,7 @@
     private String baseRelativePath;
     private String extraLocales;
     private String locale;
+    private String cache;
     
     public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
         return new Head(stack, req, res);
@@ -55,6 +56,7 @@
         head.setBaseRelativePath(baseRelativePath);
         head.setExtraLocales(extraLocales);
         head.setLocale(locale);
+        head.setCache(cache);
     }
 
     public void setDebug(String debug) {
@@ -75,5 +77,9 @@
 
     public void setLocale(String locale) {
         this.locale = locale;
+    }
+
+    public void setCache(String cache) {
+        this.cache = cache;
     }
 }