You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Curro, Joseph" <Jo...@time0.com> on 2000/03/21 23:52:44 UTC

Cached results for file producer

Hello!

We are using Cocoon 1.6.1 with JRun 2.3.3 and Netscape Enterprise Server
3.62 on Solaris.

We have been experiencing a problem related to caching when selecting a file
through a producer based on ProducerFromFile.   Our goal was to have the
following happen:

	1. Incoming request does not directly refer to a specific XML file.
Instead, the request is intercepted by a Producer that decides, based on
some work, which of several XML files to serve for that request.
	2. Based on results of a back-end routine, an XML file containing a
custom XSP tag is chosen from the file system.
	3. Custom XSP tag is expanded with dynamic data.
	4. XSLT styling is applied and fully assembled document is rendered.

Our problem is that the first file chosen in step #2 is cached, thereby
obviating the role of the producer in future requests.  Cocoon is
dynamically generating Java source code using a file name based on the
original request; after the first request, though, it effectively ignores it
if our producer returns a different file.

For example, let us say that the a user requests find.xml.  Based on our
application logic, our producer can return one of three files: file1.xml,
file2.xml, or file3.xml.  However, the first one to be returned is cached,
which we can clearly see by looking through _find.java in the JRun
repository.  So, for example, if file1.xml is the first file to be produced
by a request to find.xml, we can never have file2.xml or file3.xml returned,
regardless of the outcome of our back-end routine.  (NOTE: The structure
returned by our custom XSP tag is NOT cached.)

Is there anyway around this short of losing the benefits of caching?  We
thought about modifying the Cocoon code, so that the JRun repository creates
and uses _file1.class, _file2.class, etc., but we would like to avoid this
if possible.

Any help would be most appreciated.  I apologize in advance if my
explanation of the problem is somewhat muddled.

Thanks.

Joe