Author: tmjee Date: Wed Apr 26 07:18:55 2006 New Revision: 397201 URL: http://svn.apache.org/viewcvs?rev=397201&view=rev Log: WW-1299
Modified: incubator/webwork2/action/src/main/java/org/apache/struts/action2/StrutsConstants.java incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/FilterDispatcher.java incubator/webwork2/action/src/main/resources/org/apache/struts/action2/default.properties incubator/webwork2/action/src/test/java/org/apache/struts/action2/config/ConfigurationTest.java Modified: incubator/webwork2/action/src/main/java/org/apache/struts/action2/StrutsConstants.java URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/java/org/apache/struts/action2/StrutsConstants.java?rev=397201&r1=397200&r2=397201&view=diff ============================================================================== --- incubator/webwork2/action/src/main/java/org/apache/struts/action2/StrutsConstants.java (original) +++ incubator/webwork2/action/src/main/java/org/apache/struts/action2/StrutsConstants.java Wed Apr 26 07:18:55 2006 @@ -72,5 +72,7 @@ public static final String STRUTS_MAPPER_CLASS = "struts.mapper.class"; public static final String STRUTS_PORTLET_CONTEXT = "struts.portlet.context"; + public static final String STRUTS_SERVE_STATIC_CONTENT = "struts.serve.static"; + public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache"; } Modified: incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/FilterDispatcher.java URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/FilterDispatcher.java?rev=397201&r1=397200&r2=397201&view=diff ============================================================================== --- incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/FilterDispatcher.java (original) +++ incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/FilterDispatcher.java Wed Apr 26 07:18:55 2006 @@ -274,15 +274,22 @@ if (contentType != null) { response.setContentType(contentType); } - - // set heading information for caching static content - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - response.setHeader("Date",df.format(cal.getTime())+" GMT"); - cal.add(Calendar.DAY_OF_MONTH,1); - response.setHeader("Expires",df.format(cal.getTime())+" GMT"); - response.setHeader("Retry-After",df.format(cal.getTime())+" GMT"); - response.setHeader("Cache-Control","public"); - response.setHeader("Last-Modified",lastModified+" GMT"); + + if ("true".equals(Configuration.get(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE))) { + // set heading information for caching static content + Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + response.setHeader("Date",df.format(cal.getTime())+" GMT"); + cal.add(Calendar.DAY_OF_MONTH,1); + response.setHeader("Expires",df.format(cal.getTime())+" GMT"); + response.setHeader("Retry-After",df.format(cal.getTime())+" GMT"); + response.setHeader("Cache-Control","public"); + response.setHeader("Last-Modified",lastModified+" GMT"); + } + else { + response.setHeader("Cache-Control","no-cache"); + response.setHeader("Pragma","no-cache"); + response.setHeader("Expires","-1"); + } try { copy(is, response.getOutputStream()); Modified: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/default.properties URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/default.properties?rev=397201&r1=397200&r2=397201&view=diff ============================================================================== --- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/default.properties (original) +++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/default.properties Wed Apr 26 07:18:55 2006 @@ -55,9 +55,21 @@ struts.action.extension=action ### Used by FilterDispatcher -### If true than WW serves static content from inside its jar. -### If false than the static content must be available at <context_path>/struts +### If true then SAF serves static content from inside its jar. +### If false then the static content must be available at <context_path>/struts struts.serve.static=true + +### Used by FilterDispatcher +### This is good for development where one wants changes to the static content be +### fetch on each request. +### NOTE: This will only have effect if struts.serve.static=true +### If true -> SAF will write out header for static contents such that they will +### be cached by web browsers (using Date, Cache-Content, Pragma, Expires) +### headers). +### If false -> SAF will write out header for static contents such that they are +### NOT to be cached by web browser (using Cache-Content, Pragma, Expires +### headers) +struts.serve.static.browserCache=true ### use alternative syntax that requires %{} in most places ### to evaluate expressions for String attributes for tags Modified: incubator/webwork2/action/src/test/java/org/apache/struts/action2/config/ConfigurationTest.java URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/test/java/org/apache/struts/action2/config/ConfigurationTest.java?rev=397201&r1=397200&r2=397201&view=diff ============================================================================== --- incubator/webwork2/action/src/test/java/org/apache/struts/action2/config/ConfigurationTest.java (original) +++ incubator/webwork2/action/src/test/java/org/apache/struts/action2/config/ConfigurationTest.java Wed Apr 26 07:18:55 2006 @@ -43,7 +43,7 @@ assertEquals("de", locale.getLanguage()); int count = getKeyCount(); - assertEquals(27, count); + assertEquals(28, count); } public void testDefaultResourceBundlesLoaded() { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]