RE: Appending to CSS url to prevent caching.
followup just so in case someone else might find this useful. the wicket, out of the box css url handling works for resources in the classpath. it will not work for stuff you might have tucked away in the webapp directory which was my case. for those cases i added a custom header response decorator in the application. protected void validateInit() { super.validateInit(); setHeaderResponseDecorator( CachingStrategyDecoratingHeaderResponse. createHeaderResponseDecorator()); } its' responsibility was to append a suffix in the render??Reference methods that took a URL parameter. class CachingStrategyDecoratingHeaderResponse extends WiQueryDecoratingHeaderResponse { public void renderCSSReference(String url) { super.renderCSSReference(url+"?VERSION="+someNumber); } etc } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4653226.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
RE: Appending to CSS url to prevent caching.
You could just add your own cache buster. You could do something like: String cachebuster = "something that will always be unique - maybe time stamp"; response.renderCSSReference("style/theme.css?" + cachebuster); not sure if this will bust the cache because the file is really the same. -or- String cachebuster = "something that will always be unique - maybe time stamp"; response.renderCSSReference("style/theme-" + cachebuster + ".css"); Then you just need a url rewrite rule to change it back to style/theme.css on the server. I use something similar to this and it works great. -Original Message- From: dickster [mailto:derek.i...@gmail.com] Sent: Tuesday, October 02, 2012 5:09 PM To: users@wicket.apache.org Subject: Re: Appending to CSS url to prevent caching. sorry, i didn't give a great example. here's something better. response.renderCSSReference("style/theme.css"); it renders the html without the version parameter appended. maybe i need to do something like... response.renderCssReference(new CachingReference("style/theme.css"))??? thanks, derek. On Tue, Oct 2, 2012 at 4:31 PM, Martin Grigorov-4 [via Apache Wicket] < ml-node+s1842946n4652625...@n4.nabble.com> wrote: > On Tue, Oct 2, 2012 at 6:46 PM, dickster <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4652625&i=0>> > wrote: > > i tried using... > > getResourceSettings().setCachingStrategy(new > > FilenameWithVersionResourceCachingStrategy(new > > MessageDigestResourceVersion())); > > > > ...but not all of my urls are rewritten. the wiquery ones are but > > the > one's > > i've added via... > > renderHead(response) { > >response.renderCssReference("blah"); > > What kind of CSS this produces ? > I think this generates: > > blah > > directly in the page markup. If I'm correct then there is no need to > add anti-caching here because next render of the page will deliver > whatever is needed. > Only external file resources can be cached. > > > } > > ...don't get appended with version MD5. > > do i have to use different technique for adding them? (is my > > current > way of > > adding them not the preferred way?) > > > > > > > > > > > > > > > > > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-pre > vent-caching-tp4652508p4652618.html > > > Sent from the Users forum mailing list archive at Nabble.com. > > > > > > - To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=4652625&i=1> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=4652625&i=2> > > > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4652625&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=4652625&i=4> > > > > -- > If you reply to this email, your message will be added to the > discussion > below: > > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-pre > vent-caching-tp4652508p4652625.html > To unsubscribe from Appending to CSS url to prevent caching., click > here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.j > tp?macro=unsubscribe_by_code&node=4652508&code=ZGVyZWsuaXBvZEBnbWFpbC5 > jb218NDY1MjUwOHwtMjM5OTAwMTA0> > . > NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.j > tp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabbl > e.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamesp > ace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscrib > ers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_in > stant_email%21nabble%3Aemail.naml> > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4652626.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Appending to CSS url to prevent caching.
On Tue, Oct 2, 2012 at 6:46 PM, dickster wrote: > i tried using... > getResourceSettings().setCachingStrategy(new > FilenameWithVersionResourceCachingStrategy(new > MessageDigestResourceVersion())); > > ...but not all of my urls are rewritten. the wiquery ones are but the one's > i've added via... > renderHead(response) { >response.renderCssReference("blah"); What kind of CSS this produces ? I think this generates: blah directly in the page markup. If I'm correct then there is no need to add anti-caching here because next render of the page will deliver whatever is needed. Only external file resources can be cached. > } > ...don't get appended with version MD5. > do i have to use different technique for adding them? (is my current way of > adding them not the preferred way?) > > > > > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4652618.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: Appending to CSS url to prevent caching.
i tried using... getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(new MessageDigestResourceVersion())); ...but not all of my urls are rewritten. the wiquery ones are but the one's i've added via... renderHead(response) { response.renderCssReference("blah"); } ...don't get appended with version MD5. do i have to use different technique for adding them? (is my current way of adding them not the preferred way?) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4652618.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
Re: Appending to CSS url to prevent caching.
Recently upgraded but didn't see this feature.Awesome Thanks Sent from my iPhone On 2012-09-29, at 3:22 AM, "Martin Grigorov-4 [via Apache Wicket]" wrote: > Hi, > > Which version of Wicket do you use ? > Wicket supports this out of the box. > See https://cwiki.apache.org/WICKET/caching-in-wicket-15.html for details. > > On Fri, Sep 28, 2012 at 10:08 PM, dickster <[hidden email]> wrote: > > > i am trying to prevent pesky caching of CSS by having the html look like > > > > <-- yay,won't > > be > > cached when changed to version2 > > > > as opposed to > > > ><-- boo, > > browser caches this too aggressively. > > > > i want this change every time the version gets updated. i don't want to > > change all the usages of > > renderCssReference. I was hoping for a component/page listener that would > > have a behavior to augment the css urls. i'm sure i'm not the first to > > desire this output but haven't found the best way to do this. > > > > any ideas much appreciated. > > > > > > > > > > -- > > View this message in context: > > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden email] > > For additional commands, e-mail: [hidden email] > > > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > > - > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > > > > If you reply to this email, your message will be added to the discussion > below: > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4652520.html > To unsubscribe from Appending to CSS url to prevent caching., click here. > NAML -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508p4652525.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
Re: Appending to CSS url to prevent caching.
Hi, Which version of Wicket do you use ? Wicket supports this out of the box. See https://cwiki.apache.org/WICKET/caching-in-wicket-15.html for details. On Fri, Sep 28, 2012 at 10:08 PM, dickster wrote: > i am trying to prevent pesky caching of CSS by having the html look like > > <-- yay,won't be > cached when changed to version2 > > as opposed to > ><-- boo, > browser caches this too aggressively. > > i want this change every time the version gets updated. i don't want to > change all the usages of > renderCssReference. I was hoping for a component/page listener that would > have a behavior to augment the css urls. i'm sure i'm not the first to > desire this output but haven't found the best way to do this. > > any ideas much appreciated. > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Appending-to-CSS-url-to-prevent-caching-tp4652508.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