You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2010/09/11 15:25:32 UTC

[jira] Issue Comment Edited: (WICKET-1602) Wicket resources - wicket is requesting resources every 1 hour

    [ https://issues.apache.org/jira/browse/WICKET-1602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908316#action_12908316 ] 

Peter Ertl edited comment on WICKET-1602 at 9/11/10 9:22 AM:
-------------------------------------------------------------

After looking even more I found that

  Application.get().getResourceSettings().getDefaultCacheDuration() == 3600

So in wicket 1.4 you should

  Application.get().getResourceSettings().setDefaultCacheDuration(.....)

with some larger value to fix the premature resource reloading.

In 1.5 it doesn't even matter since resources will be cached for the maximum recommended duration of one year (see RFC-2616) when using timestamps on resources and be cacheable on public proxies / caches. Timestamps on resource names are enabled by default and can be controlled using

  Application.get().getResourceSettings().setUseTimestampOnResources(boolean)

See org.apache.wicket.request.resource.PackageResource for details:

....

		// if timestamps are enabled on resource we can maximize caching with no pain
		if(Application.get().getResourceSettings().getUseTimestampOnResources())
		{
			resourceResponse.setCacheDurationToMaximum(); // one year
			resourceResponse.setCachePublic(true);
		}

...


      was (Author: pete):
    After looking even more I found that

  Application.get().getResourceSettings().getDefaultCacheDuration() == 3600

So in wicket 1.4 you should

  Application.get().getResourceSettings().setDefaultCacheDuration(.....)

with some larger value to fix the premature resource reloading.

In 1.5 it doesn't even matter since resource will be cached for the maximum recommended duration of one year (see RFC-2616) when using timestamps on resources. These are enabled by default and can be enabled / disabled using

  Application.get().getResourceSettings().setUseTimestampOnResources(boolean)

See PackageResource for details:

		// if timestamps are enabled on resource we can maximize caching with no pain
		if(Application.get().getResourceSettings().getUseTimestampOnResources())
		{
			resourceResponse.setCacheDurationToMaximum(); // one year
			resourceResponse.setCachePublic(true);
		}

  
> Wicket resources - wicket is requesting resources every 1 hour
> --------------------------------------------------------------
>
>                 Key: WICKET-1602
>                 URL: https://issues.apache.org/jira/browse/WICKET-1602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.3
>            Reporter: Stefan Simik
>            Assignee: Peter Ertl
>             Fix For: 1.5-M3
>
>
> There is a problem with wicket ajax javascripts - there are reloading by browser every 1 hour, because the Expire header 
> is hardcoded to 3600 seconds in WebResource#setHeaders() method.
> This problem bubbles up to commonly used class ResourceReference class, which internally works 
> with PackageResource that uses our problematic class -  WebResource.
> SIMPLE AND FAST SOLUTION
> ----------------------------------------------
> The only thing, that is needed to fix this, is to change WebResource#setHeaders() to take
> the caching time from some wicket settings, so it is not hardcoded and can be configured by developer. 
> NABBLE about this problem:
> ----------------------------------------------------------------
> http://www.nabble.com/forum/ViewPost.jtp?post=17117009&framed=y

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.