Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP and Servlet Caching

 
J J Wright
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've been trying to figure out how to best tackle the issue of dynamic content caching. Whilst we're meant to basing our solution on J2EE, and we should always design to the specification (never a particular application server), we can't do this when it comes to caching dynamically generated content. You could, of course, implement your own cache but surely this goes against one of the core architectural principles we're meant to be learning/adhering to - i.e. use proven technologies and frameworks wherever possible.

I'd appreciate people's thoughts on how to address an issue, like dynamic content caching, that isn't covered by the J2EE spec. The only real standard is the JESI tag library for Edge Side Includes but this still requires you to make assumptions about you're target application server, i.e. it has an ESI processor and cache. The caching technology also has major implications for how you structure your JSP pages and fragments. Some caches like WebShpere's DynaCache require fragments to be autonomous entities that can be keyed by their URL and request parameters, while others like OSCache and JBossCache provide tag libraries that allow you to carve up single pages.

I could just put all this in my assumptions but I'm a little apprehensive about specifying a requirement on a third parting caching solution. That said, I can't think of many real world scenarios where the target application server wouldn't be known up front.

Regards,

Jonathan
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see why a specific app server needs to be used - there are plenty of ways how to go about caching within the confines of JEE.

For example, here's an early example of servlet output caching. The techniques in that article are obsolete, but the basic principles still hold.

Here's a nice writeup about caching of RSS feeds.

And there are various server-independent caching solutions available, if you don't want to roll your own.
 
J J Wright
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your comments.

I think I'll go down the OS route with something like OSCache. As you say it saves reinventing the wheel and doesn't lock me into any application server related product. I was just concerned about how Sun would react if I contravened the "write once, run anywhere" mantra. Even if I documented the decision to use a specific app server it might be frowned upon. Of course, the OS option is the best of both worlds!

Thanks,

Jonathan

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic