cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: [PROPOSAL] map:redirect-to vs. map:forward
Date Tue, 09 Apr 2002 11:47:40 GMT
Konstantin Piroumian wrote:

>Hi, team!
>
>I'd like to propose to add a <map:forward path="" /> node to sitemap.
>Behavior should be the same as <map:redirect-to uri="cocoon:/..." />.
>As redirect and forward are absolutely different in servlet environment then
>it would be better to have separate elements for them. I'd leave
><map:redirect-to /> for real redirects (with 302 status code) and use
><map:forward /> for all internal forwards.
>
>IMHO, forwarding is more obvious then redirect to 'cocoon:/...' uris and
>this will reduce the number of questions in users list about the redirection
>and its parameters. Also, I'd like to propose to add parameters support to
><map:forward />:
>
><map:forward path="next">
>	<map:parameter name="page" value="{page}" />
></map:forward>
>
>What do you think?
>

<stripping-noisy-discussion>

Wow, wow, so much noise such a "small" change proposal !!

First of all, I'd like to recall the difference between a forward (or 
internal redirect) and a resource :

- a resource is a named pipeline-snippet that is used to factorize some 
common constructs in a sitemap. Nothing more, nothing less ! The name of 
a resource is purely internal to the sitemap that declares it and only 
visible from that sitemap (and not its components). There is no pattern 
matching or anything else on a resource name.

- a forward is a new request to the Cocoon engine that doesn't go back 
to the client browser. This request is a real request with a real URI 
that is processed in the exact same way as external requests. The 
difference with an external redirect is that some enviroment data is 
kept during the forward operation : request and environment attributes 
for example.

So a <map:call> and a <map:redirect> *have nothing in common* !

As for the flow engine, I highly encourage people to go to 
scratchpad/schecoon and look at what's inside. This discussion shows 
that few people did it (no offense here, just an encouragement for you 
to look there).

The flow engine uses forwards/internal redirects to display the pages. 
It _used_ resources before internal redirect was available and there's 
still some code for this, but it *will be removed*. The *only* contract 
for calling the sitemap are requests, be there internal or external, and 
their URI. More formally, this contract is the 
org.apache.cocoon.Processor interface.

Now I'm +1 for this proposal. This makes the difference between external 
redirects and forwards more visible and avoids a "cocoon:" notation that 
may look strange to beginners. Also, a lot of users are used to the 
servlet API that clearly distinguishes redirects and forwards.

But to make things clear : <map:forward> is only another notation. 
<map:redirect-to uri="cocoon:/..."> will always be available. This is 
required if we want an action or the flow engine to be able to choose 
between forwards or external redirects.

Cheers,
Sylvain

-- 
Sylvain Wallez
  Anyware Technologies                  Apache Cocoon
  http://www.anyware-tech.com           mailto:sylvain@apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message