To the Guru's

Has anyone ever built a caching system using servlets ?

This is my scenario, I have a web site running on EJB and servlets which are
used to produce dynamic web pages. However these web pages do not change
very often and so if I could cache the HTML that is generated it would speed
up the web site loads. This mean I wouldn't have to keep going to the ejb
layer each time.

Now here is the catch.

I need to log the information our users are seeing. So for example if a web
page is generated that shows product 1,2 and 3. I need to log this
information. This is simple if the servlet EJB layer is used. However if I
have a cached page this layer is never called. However I still need to log
the information. I have done an few prototypes using a front end servlet to
do the caching. However servlets are not designed for chaining.

What I mean by that is it is hard for "servlet A" to call "Servlet B" and
read the output of that servlet into say a string. With servlets you can
only "nest" them using requestdispatcher.

One design I have is to intercept a call to the servlets running my site.
Then to open a URL connection to that servlets read in the response (eg
HTML) to a string store that string in a cache (perhaps a hashtable) then
return the response to the user. Then the next time the same request comes
in I will get the HTML string from the cache. I have logging built into this
by calling a shared log object that is stored in the servlet context when
the HTML is first generated by the EJB/servlet layer.

SO then what I want to know is has anyone else done anything like this
before and do they a better solution. I think the current design is messy
and want a more eloquent solution

Regards Peter

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to