Another option is to create a custom request cycle handler in Wicket and have the WebResponse use a custom OutputStream that caches the output for a particular URL before sending it out. Then, the request handler in the custom cycle could look at the URL and simply return the cached/saved output without giving the wicket framework a chance to regenerate the output.
Eelco, Jonathan -- someone with better knowledge of Wicket than me should probably respond but creating a CachingWebRequestCycle implementation seems like an option here right? Shahid. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius Sent: Thursday, July 14, 2005 5:02 PM To: [email protected] Subject: Re: [Wicket-user] Caching components generated markup Christian Essl wrote: > Hi Eelco, > > Thanks for you reply. I have two more questions. > > In case of static pages: I am not sure how this works together with > the rest of wicket. The pages contain also a login, search and > add-to-shopping-basket from. How do I create for static pages the > sepecial wicket-urls? Option A: I think I would have a process autogenerate it to a protected server area. Basically, you would just have some process let Wicket render your pages (your process plays browser) and trap the output and save that as pages. After that, it would be no wicket anymore, just you and your webserver. Or... option B: you could generate those pages, but still have an important role for Wicket and use the Include component (which inclused static HTML from any location). > > In my special case. I actually do not want to cache the whole page. > There should be some dynamics ie personilized offers or a poll in a > side-box. However the cacheable catalog-part does not change and is in > a panel. Is it possible to lookup the generated html of this panel in > a cache and add this to the output or in case of expired-cache let the > panel generate it and put it in the cache? > Option C: use labels with label.setShouldEscapeModelStrings(false); Now, let your model do the trick: lazily load the data, but once you have it, just cache it. If you want to, you could even render large blocks of HTML in such a label. Option D (looks like C): take a look at the Include component. It's in HEAD/ for 1.1, but if people want we can backport it. Anyway, this component includes and displays a whole chunk of HTML from another resource. Though it is not meant for including Wicket resources, it is not really wrong either if you have a good use case. And that's what you have. So, you could have a master page, and your product pages, and just let your master page include a product page. The trick then, is to make a custom version of Include that is smart enough to cache the result. One issue more: you don't want to run out of pages; each page takes a place in the session, so the Master and product page combination would take up two slots in one go (out of ten by default). You should watch this carefully when you include more Wicket pages in your master page, or do something smart with getPage().getPageMap().remove();, which removes the reference to the current page right away (and you wouldn't need the product pages in your session any longer. I think if you experiment with creating custom components a bit, you'll think of something nice ;) I'd go for option C or D. Eelco > Thanks, > Christian > > >> Hi, >> >> The markup is cached anyway. You probably want the results cached. >> >> There's tons of ways to do it, the most obvious ones being: >> - using a seperate cache, e.g. implemented as a servlet filter. I've >> used http://www.opensymphony.com/oscache/ for this in the past. If >> you only have to cache bookmarkable pages (and actually caching >> non-bookmarkable pages is not a good idea as they need session >> state), that works quite good. >> >> Above two ways are not integrated with Wicket. We could consider >> building in native support for caching, but as caching (at least the >> kind of caching we're talking about here) spans multiple sessions, it >> would not be a straight match with Wicket's design goals. >> >> Eelco >> >> >> Christian Essl wrote: >> >>> Hi, >>> >>> My most used pages are product-catalog and product-detail. Both >>> pages are and should be bookmarkable. The product-catalog page uses >>> a ListView to show all products in a category. The detail pages uses >>> a form to add the prodcut to the shopping-basket: >>> >>> Because the products do change only about every second week I want >>> to cache the markup for both pages (or better the actual panels >>> which show the products). >>> >>> Is this possible in Wicket? >>> >>> Thanks, >>> Christian >>> >>> >>> ___________________________________________________________ Gesendet >>> von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: >>> http://mail.yahoo.de >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by the 'Do More With Dual!' webinar >>> happening >>> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in >>> dual >>> core and dual graphics technology at this free one hour event hosted >>> by HP, >>> AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar >>> _______________________________________________ >>> Wicket-user mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/wicket-user >> >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by the 'Do More With Dual!' webinar >> happening >> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual >> core and dual graphics technology at this free one hour event hosted >> by HP, >> AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar >> _______________________________________________ >> Wicket-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
