CachingPage
Hi, I'm trying to adapt the 'CachingPanel' strategy from JL's '26 Wicket Tricks' to a Page, in order to cache an entire HomePage. It is a requirement that this Page (it is a HomePage) should be rendered like it was static HTML (actually the application generated that static html at some moment by means of templates). This is the source for CachingPanel from GoogleCode: http://www.google.com/codesearch/p?hl=es#92PP5HImtBs/trunk/twenty-six-wicket-tricks/src/main/java/com/locke/library/web/panels/caching/CachingPanel.javaq=caching%20package:http://twenty-six-wicket-tricks \.googlecode\.comsa=Ncd=1ct=rct=0 I've tried to simply extend WebPage instead of Panel in CachingPanel, but then it turns out in onRender's overriding that markupStream is always null... My question is: Is onRender the right method to override taking into account it is about a whole page and not a Panel (markupStream.skipComponent does not make much sense)... I'd appreciate any directions on these one, as this matter is regarding the internals of Wicket, and I'd like to have some security on what's happening behind the scenes... Thank you very much !
Re: CachingPage
So you want your page to output some content that doesn't live in HomePage.html, but from memory/db/etc instead? If that's the case, overrride hasAssociatedMarkup() and return false (tells wicket there's no HomePage.html to look for) and then in onRender() write your content using getResponse().getOutputStream(). See this link for an example: http://blog.brunoborges.com.br/2008/11/restful-web-services-with-wicket.html Craig _ From: Xavier López [mailto:xavil...@gmail.com] To: users@wicket.apache.org Sent: Thu, 10 Dec 2009 06:00:58 -0500 Subject: CachingPage Hi, I'm trying to adapt the 'CachingPanel' strategy from JL's '26 Wicket Tricks' to a Page, in order to cache an entire HomePage. It is a requirement that this Page (it is a HomePage) should be rendered like it was static HTML (actually the application generated that static html at some moment by means of templates). This is the source for CachingPanel from GoogleCode: http://www.google.com/codesearch/p?hl=es#92PP5HImtBs/trunk/twenty-six-wicket-tricks/src/main/java/com/locke/library/web/panels/caching/CachingPanel.javaq=caching%20package:http://twenty-six-wicket-tricks \.googlecode\.comsa=Ncd=1ct=rct=0 I've tried to simply extend WebPage instead of Panel in CachingPanel, but then it turns out in onRender's overriding that markupStream is always null... My question is: Is onRender the right method to override taking into account it is about a whole page and not a Panel (markupStream.skipComponent does not make much sense)... I'd appreciate any directions on these one, as this matter is regarding the internals of Wicket, and I'd like to have some security on what's happening behind the scenes... Thank you very much !
Re: CachingPage
or do it properly by letting your homepage implement IMarkupResourceStreamProvider and IMarkupCacheKeyProvider :) -igor On Thu, Dec 10, 2009 at 4:59 AM, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: So you want your page to output some content that doesn't live in HomePage.html, but from memory/db/etc instead? If that's the case, overrride hasAssociatedMarkup() and return false (tells wicket there's no HomePage.html to look for) and then in onRender() write your content using getResponse().getOutputStream(). See this link for an example: http://blog.brunoborges.com.br/2008/11/restful-web-services-with-wicket.html Craig _ From: Xavier López [mailto:xavil...@gmail.com] To: users@wicket.apache.org Sent: Thu, 10 Dec 2009 06:00:58 -0500 Subject: CachingPage Hi, I'm trying to adapt the 'CachingPanel' strategy from JL's '26 Wicket Tricks' to a Page, in order to cache an entire HomePage. It is a requirement that this Page (it is a HomePage) should be rendered like it was static HTML (actually the application generated that static html at some moment by means of templates). This is the source for CachingPanel from GoogleCode: http://www.google.com/codesearch/p?hl=es#92PP5HImtBs/trunk/twenty-six-wicket-tricks/src/main/java/com/locke/library/web/panels/caching/CachingPanel.javaq=caching%20package:http://twenty-six-wicket-tricks \.googlecode\.comsa=Ncd=1ct=rct=0 I've tried to simply extend WebPage instead of Panel in CachingPanel, but then it turns out in onRender's overriding that markupStream is always null... My question is: Is onRender the right method to override taking into account it is about a whole page and not a Panel (markupStream.skipComponent does not make much sense)... I'd appreciate any directions on these one, as this matter is regarding the internals of Wicket, and I'd like to have some security on what's happening behind the scenes... Thank you very much ! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: CachingPage
Not familiar with this approach, sounds interesting. So the page would return null from IMarkupCacheKeyProvider method when it wants to force a reload of the of the content, which then calls the IMarkupResourceStreamProvider to get the content? Does the page have to register itself with the MarkupCache or some other component as an implementer of these interfaces or are there instanceof checks at render time that will handle this? Craig -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Thursday, December 10, 2009 11:37 AM To: users@wicket.apache.org Subject: Re: CachingPage or do it properly by letting your homepage implement IMarkupResourceStreamProvider and IMarkupCacheKeyProvider :) -igor On Thu, Dec 10, 2009 at 4:59 AM, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: So you want your page to output some content that doesn't live in HomePage.html, but from memory/db/etc instead? If that's the case, overrride hasAssociatedMarkup() and return false (tells wicket there's no HomePage.html to look for) and then in onRender() write your content using getResponse().getOutputStream(). See this link for an example: http://blog.brunoborges.com.br/2008/11/restful-web-services-with-wicket.html Craig _ From: Xavier López [mailto:xavil...@gmail.com] To: users@wicket.apache.org Sent: Thu, 10 Dec 2009 06:00:58 -0500 Subject: CachingPage Hi, I'm trying to adapt the 'CachingPanel' strategy from JL's '26 Wicket Tricks' to a Page, in order to cache an entire HomePage. It is a requirement that this Page (it is a HomePage) should be rendered like it was static HTML (actually the application generated that static html at some moment by means of templates). This is the source for CachingPanel from GoogleCode: http://www.google.com/codesearch/p?hl=es#92PP5HImtBs/trunk/twenty-six-wicket-tricks/src/main/java/com/locke/library/web/panels/caching/CachingPanel.javaq=caching%20package:http://twenty-six-wicket-tricks \.googlecode\.comsa=Ncd=1ct=rct=0 I've tried to simply extend WebPage instead of Panel in CachingPanel, but then it turns out in onRender's overriding that markupStream is always null... My question is: Is onRender the right method to override taking into account it is about a whole page and not a Panel (markupStream.skipComponent does not make much sense)... I'd appreciate any directions on these one, as this matter is regarding the internals of Wicket, and I'd like to have some security on what's happening behind the scenes... Thank you very much ! - 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: CachingPage
there are instanceof checks at render time, and returning a null simply means dont cache my markup -igor On Thu, Dec 10, 2009 at 1:27 PM, Craig McIlwee craig.mcil...@openroadsconsulting.com wrote: Not familiar with this approach, sounds interesting. So the page would return null from IMarkupCacheKeyProvider method when it wants to force a reload of the of the content, which then calls the IMarkupResourceStreamProvider to get the content? Does the page have to register itself with the MarkupCache or some other component as an implementer of these interfaces or are there instanceof checks at render time that will handle this? Craig -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Thursday, December 10, 2009 11:37 AM To: users@wicket.apache.org Subject: Re: CachingPage or do it properly by letting your homepage implement IMarkupResourceStreamProvider and IMarkupCacheKeyProvider :) -igor On Thu, Dec 10, 2009 at 4:59 AM, McIlwee, Craig craig.mcil...@openroadsconsulting.com wrote: So you want your page to output some content that doesn't live in HomePage.html, but from memory/db/etc instead? If that's the case, overrride hasAssociatedMarkup() and return false (tells wicket there's no HomePage.html to look for) and then in onRender() write your content using getResponse().getOutputStream(). See this link for an example: http://blog.brunoborges.com.br/2008/11/restful-web-services-with-wicket.html Craig _ From: Xavier López [mailto:xavil...@gmail.com] To: users@wicket.apache.org Sent: Thu, 10 Dec 2009 06:00:58 -0500 Subject: CachingPage Hi, I'm trying to adapt the 'CachingPanel' strategy from JL's '26 Wicket Tricks' to a Page, in order to cache an entire HomePage. It is a requirement that this Page (it is a HomePage) should be rendered like it was static HTML (actually the application generated that static html at some moment by means of templates). This is the source for CachingPanel from GoogleCode: http://www.google.com/codesearch/p?hl=es#92PP5HImtBs/trunk/twenty-six-wicket-tricks/src/main/java/com/locke/library/web/panels/caching/CachingPanel.javaq=caching%20package:http://twenty-six-wicket-tricks \.googlecode\.comsa=Ncd=1ct=rct=0 I've tried to simply extend WebPage instead of Panel in CachingPanel, but then it turns out in onRender's overriding that markupStream is always null... My question is: Is onRender the right method to override taking into account it is about a whole page and not a Panel (markupStream.skipComponent does not make much sense)... I'd appreciate any directions on these one, as this matter is regarding the internals of Wicket, and I'd like to have some security on what's happening behind the scenes... Thank you very much ! - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org