Re: help with cache

> 1) Is it possible in a filter to get the file that is being served?
The file content will be on an inputstream. You can read this to
completion yourself, save to your own database, then recreate
a new inputstream that is a copy of the orginal and give to
the rest of the filter stack.

How can we retrieve something in the cache, based on the URL?
Use a database or hash table. You may want to standardise or ignore
any time dynamic parts of a URL such as jsessionId.

> 3) How does the cache stores dynamic file (such as
> www.site.com/search?q=toto&titi;jsessionId=1234564 )
You don't need to know. You will write your own cache
mechanism which ignores the time or session related parts of
the request (since they will may change on replay and you still
want a cache hit. You should add a sequence number to the key when
you cache content, so that dynamic and changing content (from a constant
url) is served in the correct sequence (keep a count).

> 
> My problem is that I want to STORE everything the user browses ... (is for
> an e-learning tool). I think I'll be problems when no-cache header is
> activated ...
No problem, your filters should be before jigsaws caches and will
ignore the nocache headers.

Just do it, build in tracing, and fix problems as they arise.

You could even write your own proxy from scratch. Its just
bytes on port 80 and the urls are line 1!

> 
> Thanks and regards,
> 
> Stéphane

-- 
Christopher William Turner, http://www.cycom.co.uk/ "Serving fine Java
since 1996"

Received on Sunday, 20 January 2002 08:48:17 UTC