You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Konstantin Piroumian <KP...@protek.com> on 2002/04/09 10:47:04 UTC

[PROPOSAL] map:redirect-to vs. map:forward

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?

--
Konstantin
_________________________________________
Konstantin Piroumian
Lead Developer
ICQ#: 2297575
* Work Tel#:  +7 095 795 0520 * 1288
* More ways to contact me <http://web.icq.com/wwp?Uin=2297575> 
i See more about me <http://kot-p.hotbox.ru/> 
_________________________________________



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


Re: [PROPOSAL] map:redirect-to vs. map:forward

Posted by Stuart Roebuck <st...@adolos.co.uk>.
On Tuesday, April 9, 2002, at 10:17 AM, Nicola Ken Barozzi wrote:

>
>> 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:/..." />.
>
> What's different from current map:call ?
>
>         <map:call resource="dynamic-page">
>            <map:parameter name="target" value="{../target}1"/>
>         </map:call>

I can see value in a more explicit facility for redirecting to an 
existing sitemap match as opposed to a resource.  However, if this is 
the case, then I presume that the passed parameters would be treated as 
http request parameters and not variables in the environment map.

For reasons of accessibility there are situations when it would be 
extremely valuable to output the contents of another web page in 
response to request failure or other detectable condition without using 
a 'real redirect' (status code 302).  Real redirects are considered a 
'no no' on accessible sites but producing the resulting pages as 
resources instead of site matches seems clumsy and unrepresentative of 
the intention of the code.

I believe that this facility is already available in the form (but I 
haven't tried it!):

	<map:redirect-to uri="cocoon://path?param1=value1&amp;param2=value2" />

But as Konstantine says, this is not very intuitive and I would be +1 
for:

	<map:forward path="path">
		<map:parameter name="param1" value="value1" />
		<map:parameter name="param2" value="value2" />
	</map:forward>

Stuart.




            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
-------------------------------------------------------------------------
Stuart Roebuck                                  stuart.roebuck@adolos.com
Systems Architect                             Java, XML, MacOS X, XP, 
etc.
ADOLOS                                           <http://www.adolos.com/>


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


Re: [PROPOSAL] map:redirect-to vs. map:forward

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "Konstantin Piroumian" <KP...@protek.com>



> 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:/..." />.

What's different from current map:call ?

        <map:call resource="dynamic-page">
           <map:parameter name="target" value="{../target}1"/>
        </map:call>

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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


Re: [PROPOSAL] map:redirect-to vs. map:forward

Posted by Ivelin Ivanov <iv...@apache.org>.
+1


I'm also a bit confused by the cocoon:
proto. Isn't there more to it than just forward?

The parameters to forward are request attributes correct?
You can't add request parameters with server side forward.


----- Original Message -----
From: "Konstantin Piroumian" <KP...@protek.com>
To: <co...@xml.apache.org>
Sent: Tuesday, April 09, 2002 3:47 AM
Subject: [PROPOSAL] map:redirect-to vs. map:forward


> 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?
>
> --
> Konstantin
> _________________________________________
> Konstantin Piroumian
> Lead Developer
> ICQ#: 2297575
> * Work Tel#:  +7 095 795 0520 * 1288
> * More ways to contact me <http://web.icq.com/wwp?Uin=2297575>
> i See more about me <http://kot-p.hotbox.ru/>
> _________________________________________
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


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


Re: [PROPOSAL] map:redirect-to vs. map:forward

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
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