You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stefano Mazzocchi <st...@apache.org> on 2000/01/02 22:58:33 UTC

Re: post requests

Jerm wrote:
> 
> Dear All.
> 
> Has anyone thought about how people who are serving sites via Cocoon
> will handle post requests that require xml (or other) file writing, database
> modification, or XML node addition and modification to existing XML files on the
> server?
> 
> Is this something that should be integrated into Cocoon?
> If so how?
> 
> Or should this be handled by traditional servelet/cgi etc?
> 
> I would personally love the symmetry .... flowing html (form content) back
> through my server via XSL into XML .... closes the loop.

Not a lot, but I've been thinking about this lack of symmetry.

There are some technologies (see DataChannel XPages) that provide hooks
for easier connection between XML web-application and other resources,
but we are on the bleeding edge and there is not much you can do.

If you think deeply about it, this is a non issue: what takes care of
handling POST requests (or any request that modify the status of the
information system) is all contained into the logic realm. So, you can
write your custom producer, or your custom XSP page (which is an easier
way to do the same thing) and let cocoon handle the publishing of the
resulting page (normally something like "yes, your commit was succesful"
or something like that).

Some people proposed to add some XML capabilities to HTTP so that the
request payload is already XML-formatted, but I don't think this solves
anything.

Or you could have a HTTP request filter that XML-ize it, as already
proposed by others... but do you seriously think it's easier for your
logic to use XML API instead of simple Servlet API methods?

IMO, the search for symmetry in this area is nonsense. Logic is logic,
content is content. The only content provided by a POST handler is the
result message and, yes, this will be handled by Cocoon.

Anything else is logic driven and Cocoon should not touch it.

Careful, I'm not saying you should use pure servlets or pure java code,
no, there might be APIs that make your job easier, but this has
_nothing_ to do with the format used to send the page to the browser,
but only to the request/response system used (which always is HTTP for
servlet).

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Re: post requests

Posted by Stefano Mazzocchi <st...@apache.org>.
Jeremy Quinn wrote:
> 
> On 2/1/00 at 10:58 pm, stefano@apache.org (Stefano Mazzocchi) wrote:
> 
> >> Has anyone thought about how people who are serving sites via Cocoon
> >> will handle post requests that require xml (or other) file writing, database
> >> modification, or XML node addition and modification to existing XML files on
> >> the server?
> 
> >Not a lot, but I've been thinking about this lack of symmetry.
> [...]
> >If you think deeply about it, this is a non issue: what takes care of
> >handling POST requests (or any request that modify the status of the
> >information system) is all contained into the logic realm. So, you can
> >write your custom producer, or your custom XSP page (which is an easier
> >way to do the same thing) and let cocoon handle the publishing of the
> >resulting page (normally something like "yes, your commit was succesful"
> >or something like that).
> 
> One issue for me is controlling the cache.
> 
> If I write a custom producer, or XSP Page to handle POST request data for my
> application, it's job would be to modify the XML content of the site as a result
> of user input.

Right.
 
> Would a Producer have access to Cocoon at this level?

Sure. All you need is writing permissions on the file, commit
permissions on a CVS or on every other database that contains the status
of your web site. Cocoon is on the other side: doesn't care about what
you do in your producer (exatly like a servlet engine doesn't care about
what you do in your servlets)
 
> As an example, I am developing a site made up of interlinked pages that lookup
> information like <title>, <about> etc. from each other to build html links
> (using XSL). Change the <title> of one page and several other pages that relate
> to it need re-rendering.

> My logic can determine which pages need to be refreshed, but how would it do
> this?

> As a last resort, my logic could request the pages via http with a "nocache"
> header or an artificially old "last-modified" date, but this is a bit of a long
> way around, and I have not even checked to see if Cocoon does anything with a
> nocache message.
> 
> Any thoughts on this?

The Cocoon cache will look if any of the documents that partecipate to
the production has changed. If this is so, the document is recreated.
That's it.

If the request comes to cocoon or not depending on proxying issues, this
is none of our concerns, but up to you that setup the response headers.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Re: post requests

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 2/1/00 at 10:58 pm, stefano@apache.org (Stefano Mazzocchi) wrote:

>> Has anyone thought about how people who are serving sites via Cocoon
>> will handle post requests that require xml (or other) file writing, database
>> modification, or XML node addition and modification to existing XML files on 
>> the server?

>Not a lot, but I've been thinking about this lack of symmetry.
[...]
>If you think deeply about it, this is a non issue: what takes care of
>handling POST requests (or any request that modify the status of the
>information system) is all contained into the logic realm. So, you can
>write your custom producer, or your custom XSP page (which is an easier
>way to do the same thing) and let cocoon handle the publishing of the
>resulting page (normally something like "yes, your commit was succesful"
>or something like that).

One issue for me is controlling the cache.

If I write a custom producer, or XSP Page to handle POST request data for my
application, it's job would be to modify the XML content of the site as a result
of user input. 

Would a Producer have access to Cocoon at this level?

As an example, I am developing a site made up of interlinked pages that lookup
information like <title>, <about> etc. from each other to build html links
(using XSL). Change the <title> of one page and several other pages that relate
to it need re-rendering.

My logic can determine which pages need to be refreshed, but how would it do
this?

As a last resort, my logic could request the pages via http with a "nocache"
header or an artificially old "last-modified" date, but this is a bit of a long
way around, and I have not even checked to see if Cocoon does anything with a
nocache message. 


Any thoughts on this?

regards Jeremy

      ____________________________________________________________________

      Jeremy Quinn                                             media.demon
                                                           webSpace Design
     <ma...@media.demon.co.uk>       <http://www.media.demon.co.uk>
      <phone:+44.[0].207.737.6831>          <pa...@sms.genie.co.uk>