You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pe...@apache.org on 2010/09/11 12:50:57 UTC

svn commit: r996118 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: protocol/http/RequestUtils.java request/resource/AbstractResource.java

Author: pete
Date: Sat Sep 11 10:50:57 2010
New Revision: 996118

URL: http://svn.apache.org/viewvc?rev=996118&view=rev
Log:
Caching duration should not require a [long], having an [int] with roughly 2^31 seconds (~ 68 years) should be enough. Especially since RFC-2616 suggests caching should not exceed one year.

This will adjust to IResourceSettings#getDefaultCacheDuration() which already was an [int].

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java?rev=996118&r1=996117&r2=996118&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java Sat Sep 11 10:50:57 2010
@@ -309,7 +309,7 @@ public final class RequestUtils
 	 *
 	 * @see RequestUtils#MAX_CACHE_DURATION
 	 */
-	public static void enableCaching(WebResponse response, long duration, boolean cachePublic)
+	public static void enableCaching(WebResponse response, int duration, boolean cachePublic)
 	{
 		Args.notNull(response, "response");
 

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java?rev=996118&r1=996117&r2=996118&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java Sat Sep 11 10:50:57 2010
@@ -78,7 +78,7 @@ public abstract class AbstractResource i
 		private Date lastModified = null;
 		private WriteCallback writeCallback;
 		private boolean cacheable = true;
-		private long cacheDuration;
+		private int cacheDuration;
 
 		/**
 		 * Construct.
@@ -320,7 +320,7 @@ public abstract class AbstractResource i
 		 * @param cacheDuration
 		 *            caching duration in seconds
 		 */
-		public void setCacheDuration(long cacheDuration)
+		public void setCacheDuration(int cacheDuration)
 		{
 			this.cacheDuration = cacheDuration;
 		}
@@ -328,7 +328,7 @@ public abstract class AbstractResource i
 		/**
 		 * @return duration for which the resource shoudl be cached on client (in seconds)
 		 */
-		public long getCacheDuration()
+		public int getCacheDuration()
 		{
 			return cacheDuration;
 		}



Re: svn commit: r996118 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: protocol/http/RequestUtils.java request/resource/AbstractResource.java

Posted by Igor Vaynberg <ig...@gmail.com>.
why cant this take Duration instead of an int?

-igor

On Sat, Sep 11, 2010 at 3:50 AM,  <pe...@apache.org> wrote:
> Author: pete
> Date: Sat Sep 11 10:50:57 2010
> New Revision: 996118
>
> URL: http://svn.apache.org/viewvc?rev=996118&view=rev
> Log:
> Caching duration should not require a [long], having an [int] with roughly 2^31 seconds (~ 68 years) should be enough. Especially since RFC-2616 suggests caching should not exceed one year.
>
> This will adjust to IResourceSettings#getDefaultCacheDuration() which already was an [int].
>
> Modified:
>    wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java
>    wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
>
> Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java
> URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java?rev=996118&r1=996117&r2=996118&view=diff
> ==============================================================================
> --- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java (original)
> +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/RequestUtils.java Sat Sep 11 10:50:57 2010
> @@ -309,7 +309,7 @@ public final class RequestUtils
>         *
>         * @see RequestUtils#MAX_CACHE_DURATION
>         */
> -       public static void enableCaching(WebResponse response, long duration, boolean cachePublic)
> +       public static void enableCaching(WebResponse response, int duration, boolean cachePublic)
>        {
>                Args.notNull(response, "response");
>
>
> Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
> URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java?rev=996118&r1=996117&r2=996118&view=diff
> ==============================================================================
> --- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java (original)
> +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/resource/AbstractResource.java Sat Sep 11 10:50:57 2010
> @@ -78,7 +78,7 @@ public abstract class AbstractResource i
>                private Date lastModified = null;
>                private WriteCallback writeCallback;
>                private boolean cacheable = true;
> -               private long cacheDuration;
> +               private int cacheDuration;
>
>                /**
>                 * Construct.
> @@ -320,7 +320,7 @@ public abstract class AbstractResource i
>                 * @param cacheDuration
>                 *            caching duration in seconds
>                 */
> -               public void setCacheDuration(long cacheDuration)
> +               public void setCacheDuration(int cacheDuration)
>                {
>                        this.cacheDuration = cacheDuration;
>                }
> @@ -328,7 +328,7 @@ public abstract class AbstractResource i
>                /**
>                 * @return duration for which the resource shoudl be cached on client (in seconds)
>                 */
> -               public long getCacheDuration()
> +               public int getCacheDuration()
>                {
>                        return cacheDuration;
>                }
>
>
>