You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Upayavira <uv...@upaya.co.uk> on 2003/04/17 21:56:30 UTC

Re: CLI caching, etc

> >>Before you go further with this... Look at method
> >>isResponseModified() in [1].
> >> 
> >>What you need to do is to:
> >>1. Implement method isResponseModified() for command line
> >>environment. 2. In the CLI, get the file corresponding to the
> >>request URI, and get its last modification time. 3. Populate
> >>environment with this modification time (this will be similar to
> >>If-Modified-Since date header in http). 4. Call cocoon. It will skip
> >>generation if response is not modified, and won't even read it from
> >>cache.
> >>    
> >>
> >
> >Very interesting. So Cocoon can tell me if something has been
> >modified. Great. 

> Yes, and it works in http env.

I've implemented something around this, with a cache that seems more or less to 
work. However, when I run org.apache.cocoon.Cocoon.process(), my methods that 
I've implemented on the AbstractCommandLineEnvironment do not get called (i.e. 
isResponseModified and setResponseIsNotModified). What do I need to do to get 
Cocoon to actually call these methods on my environment?

> >Once I've got this going, I'll get on with attempting a VFS
> >ModifiableSource (probably once I've had a three week holiday in
> >South Africa!).

> 3 week... Lucky you.

But it'll be three weeks without Cocoon :-(

Regards, Upayavira

Re: CLI caching, etc

Posted by Vadim Gritsenko <va...@verizon.net>.
Upayavira wrote:

>>>>Before you go further with this... Look at method
>>>>isResponseModified() in [1].
>>>>
>>>>What you need to do is to:
>>>>1. Implement method isResponseModified() for command line
>>>>environment. 2. In the CLI, get the file corresponding to the
>>>>request URI, and get its last modification time. 3. Populate
>>>>environment with this modification time (this will be similar to
>>>>If-Modified-Since date header in http). 4. Call cocoon. It will skip
>>>>generation if response is not modified, and won't even read it from
>>>>cache.
>>>>   
>>>>
>>>>        
>>>>
>>>Very interesting. So Cocoon can tell me if something has been
>>>modified. Great. 
>>>      
>>>
>
>  
>
>>Yes, and it works in http env.
>>    
>>
>
>I've implemented something around this, with a cache that seems more or less to 
>work. However, when I run org.apache.cocoon.Cocoon.process(), my methods that 
>I've implemented on the AbstractCommandLineEnvironment do not get called (i.e. 
>isResponseModified and setResponseIsNotModified). What do I need to do to get 
>Cocoon to actually call these methods on my environment?
>

/me doing some digging...

There is a reference to the isResponseModified in 
AbstractProcessingPipeline.checkLastModified [1]. From what I see, this 
method is intended to work only for readers. Which is unfortunate. What 
do you think - can we extend pipeline implementation to support this for 
event pipelines too? Sylvain / Carsten, opinion? :-)

(I don't have Cocoon checkout at hands right now; so can't give better 
advice)

Vadim

[1] 
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java?rev=1.1&content-type=text/vnd.viewcvs-markup