You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christopher Painter-Wakefield <pa...@mc.duke.edu> on 2002/05/22 21:22:47 UTC

C2: how do I redirect in an Action?

What is the proper way to redirect in an Action?

I presume we are supposed to use the Redirector object, since nothing else
seems able.  I've looked at the Redirector interface, but the API docs have
zero explanation (grrrr!) of the methods.  If this is the right object,
then:
1) what is the difference between redirect() and globalRedirect() and which
one should I use?
2) what is the meaning of the boolean "sessionmode" parameter?

I've searched the list archives and looked through the source and am none
the wiser.

Thanks,
Christopher


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how do I redirect in an Action?

Posted by Nicola Ken Barozzi <ni...@apache.org>.
> Liam Morley
>
> On Wed, 22 May 2002, Nicola Ken Barozzi wrote:
>
> > From: "Christopher Painter-Wakefield" <pa...@mc.duke.edu>
> >
> > > What is the proper way to redirect in an Action?
> >
> > Why do you have to redirect in an action?
> > I would not suggest it.
> >
> > Redirect instead in the sitemap based on the results of the Action.
> >
> I've always used the "redirect" method of the Redirector class. I'm
> assuming that redirect uses a local, relative path (for internal links)
> and globalRedirect uses a global path (for external links), but I haven't
> tested this and can't be sure. I also assume that sessionmode dictates
> whether or not to pass the session cookie on (there is a similar attribute
> in the sitemap redirect-to), but again I'm not sure and haven't tested.
>
> there have been times where I have wanted to redirect to the referer from
> an action, so that the action simply changes the state of something on the
> website (for instance, a log-in). I suppose I could pass the referer's
> address to the sitemap.. I'd be interested in hearing reasons of keeping
> the redirect in the sitemap, other than the fact that any changes to java
> code mean recompiling/restarting.. but changes to the sitemap also require
> recompiling and restarting tomcat, which seem to take longer for me (as
> the sitemap can no longer be loaded from cache).

Changes to the sitemap don't require recompiling and restarting tomcat.
If you need to do it, there is something plainly wrong with your Cocoon; I
can't imagine how you managed to keep using cocoon given this :-O

Anyway, the main reason is architectural.

Cocoon was made with a sitemap because this makes the flow control and the
component declaration in a central place; the whole site is much easier to
administer and the components are easier to reuse.

If your Action redirects to a specific url, it's difficult to reuse it in
other sitemaps.

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


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how do I redirect in an Action?

Posted by Liam Morley <lm...@lovecraft.gdc.wpi.edu>.
I've always used the "redirect" method of the Redirector class. I'm
assuming that redirect uses a local, relative path (for internal links)
and globalRedirect uses a global path (for external links), but I haven't
tested this and can't be sure. I also assume that sessionmode dictates
whether or not to pass the session cookie on (there is a similar attribute
in the sitemap redirect-to), but again I'm not sure and haven't tested.

there have been times where I have wanted to redirect to the referer from
an action, so that the action simply changes the state of something on the
website (for instance, a log-in). I suppose I could pass the referer's
address to the sitemap.. I'd be interested in hearing reasons of keeping
the redirect in the sitemap, other than the fact that any changes to java
code mean recompiling/restarting.. but changes to the sitemap also require
recompiling and restarting tomcat, which seem to take longer for me (as
the sitemap can no longer be loaded from cache).

Liam Morley


On Wed, 22 May 2002, Nicola Ken Barozzi wrote:

> From: "Christopher Painter-Wakefield" <pa...@mc.duke.edu>
>
> > What is the proper way to redirect in an Action?
>
> Why do you have to redirect in an action?
> I would not suggest it.
>
> Redirect instead in the sitemap based on the results of the Action.
>
>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: how do I redirect in an Action?

Posted by Nicola Ken Barozzi <ni...@apache.org>.
From: "Christopher Painter-Wakefield" <pa...@mc.duke.edu>

> What is the proper way to redirect in an Action?

Why do you have to redirect in an action?
I would not suggest it.

Redirect instead in the sitemap based on the results of the Action.

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


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>