You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Jain <Er...@isb-sib.ch> on 2006/01/07 12:54:50 UTC
Redirection
Is there any way I could get an ActionForward to do permanent (301) rather
than temporary (302) redirects?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Redirection
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Currently (i.e. Struts 1.2.x) this is done in the processForwardConfig()
method of the RequestProcessor - if the ActionMapping has "redirect" set to
true it calls the sendRedirect(url) method - which as I understand it is a
convenience method for setting a "302" status and "location" header.
Currently you would have to create your own custom RequestProcessor to
achieve this and override the processForwardConfig() method to do this.
Not sure about "isPermanent" - looks like there are a number of
"redirection" status codes according to the spec - 301/302/303/307
ftp://ftp.isi.edu/in-notes/rfc2616.txt
Niall
----- Original Message -----
From: "Dakota Jack" <da...@gmail.com>
Sent: Saturday, January 07, 2006 3:06 PM
Hi, Eric,
I think you have to go back through the code and find out where the status
codes are handled. I have to admit that I don't know. If someone else
does, this would be great information to have. This is an interesting
problem and one that I always put on the back burner. Maybe now is the time
to make some decisions about what to do.
On 1/7/06, Eric Jain <Er...@isb-sib.ch> wrote:
>
> Mark Lowe wrote:
> > Not sure if i've understood what you're after, but you can just write
> > to the reponse (as you would in a normal servlet) and return null for
> > you action forward. Your webapp configuration will do the rest from
> > there like with any webapp.
>
> Yes, that's a solution. On the other hand ActionForwards are convenient to
> use (no need to worry about paths etc.), so I was wondering if you could
> do
> something like:
>
> forward.setRedirect(true); // existing method
> forward.setPermanent(true); // possible extension?
>
> I know it is possible to implement your own ActionForward classes, but I'm
> not sure that would help here. Ideally the RequestProcessor would ask the
> ActionForward for a status code at one point...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Redirection
Posted by Dakota Jack <da...@gmail.com>.
Hi, Eric,
I think you have to go back through the code and find out where the status
codes are handled. I have to admit that I don't know. If someone else
does, this would be great information to have. This is an interesting
problem and one that I always put on the back burner. Maybe now is the time
to make some decisions about what to do.
On 1/7/06, Eric Jain <Er...@isb-sib.ch> wrote:
>
> Mark Lowe wrote:
> > Not sure if i've understood what you're after, but you can just write
> > to the reponse (as you would in a normal servlet) and return null for
> > you action forward. Your webapp configuration will do the rest from
> > there like with any webapp.
>
> Yes, that's a solution. On the other hand ActionForwards are convenient to
> use (no need to worry about paths etc.), so I was wondering if you could
> do
> something like:
>
> forward.setRedirect(true); // existing method
> forward.setPermanent(true); // possible extension?
>
> I know it is possible to implement your own ActionForward classes, but I'm
> not sure that would help here. Ideally the RequestProcessor would ask the
> ActionForward for a status code at one point...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
Re: Redirection
Posted by Eric Jain <Er...@isb-sib.ch>.
Mark Lowe wrote:
> Not sure if i've understood what you're after, but you can just write
> to the reponse (as you would in a normal servlet) and return null for
> you action forward. Your webapp configuration will do the rest from
> there like with any webapp.
Yes, that's a solution. On the other hand ActionForwards are convenient to
use (no need to worry about paths etc.), so I was wondering if you could do
something like:
forward.setRedirect(true); // existing method
forward.setPermanent(true); // possible extension?
I know it is possible to implement your own ActionForward classes, but I'm
not sure that would help here. Ideally the RequestProcessor would ask the
ActionForward for a status code at one point...
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Redirection
Posted by Mark Lowe <me...@gmail.com>.
Not sure if i've understood what you're after, but you can just write
to the reponse (as you would in a normal servlet) and return null for
you action forward. Your webapp configuration will do the rest from
there like with any webapp.
On 1/7/06, Eric Jain <Er...@isb-sib.ch> wrote:
> Is there any way I could get an ActionForward to do permanent (301) rather
> than temporary (302) redirects?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org