Re: Cache TextTemplateResourceReferences

2012-03-01 Thread Martin Grigorov
Hi,

I see this is problematic indeed...
Here is how you can achieve this:

class MyPackageTTRR extends TextTemplateResourceReference {

  @Override
  public IResource getResource() {
ResourceStreamResource resource = (ResourceStreamResource) resource;
resource.setCacheDuration(Duration.xyz);
return resource;
  }
}

On Wed, Feb 29, 2012 at 7:52 PM, exaptis david.loid...@gmail.com wrote:
 Hi,

 i've been following this post in order to generate dynamic JS/CSS files (
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 ).

 Now I'm expiring white page flickers on page changes inside the browser,
 due to the fact that TextTemplateResourceReferences are not versioned
 (filename-ver-timestamp.ext) or sent with Cache-Headers (per default
 they are delivered with Cache: no-cache). As soon as we have uncached CSS or
 JS files FF/IE/Chrome/Safari seem to reload the whole page instead of
 applying the cached files and this leads to these annoying page flickers.

 So i'm searching for a solution to be able to cache
 TextTemplateResourceReferences by enabling the version and setting the cache
 headers, but I haven't found a solution yet.

 I'm using Wicket 1.5.3.

 From a friend of mine I got the tip to check IStaticCacheableResources and
 subclass TextTemplateResourceReference in order to return
 IStaticCacheableResources, but I didn't have the time yet to test it out.
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html

 Any help on this would be really great, as I'm quite new to wicket and
 haven't found a good tutorial yet which explains how caching for resources
 is properly applied.



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Cache-TextTemplateResourceReferences-tp4432342p4432342.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Cache TextTemplateResourceReferences

2012-03-01 Thread Peter Ertl
just one little addition...

instead of

   response.setCacheDuration

use

  response.enableCaching(Duration., WebResponse.CacheScope.)



Am 01.03.2012 um 09:08 schrieb Martin Grigorov:

 Hi,
 
 I see this is problematic indeed...
 Here is how you can achieve this:
 
 class MyPackageTTRR extends TextTemplateResourceReference {
 
  @Override
  public IResource getResource() {
ResourceStreamResource resource = (ResourceStreamResource) resource;
resource.setCacheDuration(Duration.xyz);
return resource;
  }
 }
 
 On Wed, Feb 29, 2012 at 7:52 PM, exaptis david.loid...@gmail.com wrote:
 Hi,
 
 i've been following this post in order to generate dynamic JS/CSS files (
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 ).
 
 Now I'm expiring white page flickers on page changes inside the browser,
 due to the fact that TextTemplateResourceReferences are not versioned
 (filename-ver-timestamp.ext) or sent with Cache-Headers (per default
 they are delivered with Cache: no-cache). As soon as we have uncached CSS or
 JS files FF/IE/Chrome/Safari seem to reload the whole page instead of
 applying the cached files and this leads to these annoying page flickers.
 
 So i'm searching for a solution to be able to cache
 TextTemplateResourceReferences by enabling the version and setting the cache
 headers, but I haven't found a solution yet.
 
 I'm using Wicket 1.5.3.
 
 From a friend of mine I got the tip to check IStaticCacheableResources and
 subclass TextTemplateResourceReference in order to return
 IStaticCacheableResources, but I didn't have the time yet to test it out.
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 
 Any help on this would be really great, as I'm quite new to wicket and
 haven't found a good tutorial yet which explains how caching for resources
 is properly applied.
 
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Cache-TextTemplateResourceReferences-tp4432342p4432342.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Cache TextTemplateResourceReferences

2012-03-01 Thread Peter Ertl
oops, I did not read carefully  :-P

it's 'resource' not 'response' so just erase my last post ...


Am 01.03.2012 um 15:31 schrieb Peter Ertl:

 just one little addition...
 
 instead of
 
   response.setCacheDuration
 
 use
 
  response.enableCaching(Duration., WebResponse.CacheScope.)
 
 
 
 Am 01.03.2012 um 09:08 schrieb Martin Grigorov:
 
 Hi,
 
 I see this is problematic indeed...
 Here is how you can achieve this:
 
 class MyPackageTTRR extends TextTemplateResourceReference {
 
 @Override
 public IResource getResource() {
   ResourceStreamResource resource = (ResourceStreamResource) resource;
   resource.setCacheDuration(Duration.xyz);
   return resource;
 }
 }
 
 On Wed, Feb 29, 2012 at 7:52 PM, exaptis david.loid...@gmail.com wrote:
 Hi,
 
 i've been following this post in order to generate dynamic JS/CSS files (
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
 ).
 
 Now I'm expiring white page flickers on page changes inside the browser,
 due to the fact that TextTemplateResourceReferences are not versioned
 (filename-ver-timestamp.ext) or sent with Cache-Headers (per default
 they are delivered with Cache: no-cache). As soon as we have uncached CSS or
 JS files FF/IE/Chrome/Safari seem to reload the whole page instead of
 applying the cached files and this leads to these annoying page flickers.
 
 So i'm searching for a solution to be able to cache
 TextTemplateResourceReferences by enabling the version and setting the cache
 headers, but I haven't found a solution yet.
 
 I'm using Wicket 1.5.3.
 
 From a friend of mine I got the tip to check IStaticCacheableResources and
 subclass TextTemplateResourceReference in order to return
 IStaticCacheableResources, but I didn't have the time yet to test it out.
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 
 Any help on this would be really great, as I'm quite new to wicket and
 haven't found a good tutorial yet which explains how caching for resources
 is properly applied.
 
 
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Cache-TextTemplateResourceReferences-tp4432342p4432342.html
 Sent from the Users forum mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Cache TextTemplateResourceReferences

2012-02-29 Thread exaptis
Hi,

i've been following this post in order to generate dynamic JS/CSS files (
https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
).

Now I'm expiring white page flickers on page changes inside the browser,
due to the fact that TextTemplateResourceReferences are not versioned
(filename-ver-timestamp.ext) or sent with Cache-Headers (per default
they are delivered with Cache: no-cache). As soon as we have uncached CSS or
JS files FF/IE/Chrome/Safari seem to reload the whole page instead of
applying the cached files and this leads to these annoying page flickers.

So i'm searching for a solution to be able to cache
TextTemplateResourceReferences by enabling the version and setting the cache
headers, but I haven't found a solution yet. 

I'm using Wicket 1.5.3.

From a friend of mine I got the tip to check IStaticCacheableResources and
subclass TextTemplateResourceReference in order to return
IStaticCacheableResources, but I didn't have the time yet to test it out. 
http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 
http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket-core/1.5.0/wicket-core-1.5.0-javadoc.jar!/org/apache/wicket/request/resource/caching/IStaticCacheableResource.html
 

Any help on this would be really great, as I'm quite new to wicket and
haven't found a good tutorial yet which explains how caching for resources
is properly applied. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cache-TextTemplateResourceReferences-tp4432342p4432342.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org