Karen,
I had this issue once upon a time as well... unfortunately a 301 is much
more tricky to setup than a 302.
With the help of Google and code snippets on the net I put together the
following class:
public class RedirectPermanentResolution extends RedirectResolution {
public RedirectPermanentResolution(String url) {
super(url);
}
@Override
public void execute(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
HttpServletResponseWrapper resWrap = new
HttpServletResponseWrapper(res) {
@Override
public void setStatus(int sc) {
// Short circuit allowing the status to ever change
(already set to SC_MOVED_PERMANENTLY)
}
@Override
public void sendRedirect(String location) throws IOException {
setHeader("Location", location);
}
};
super.execute(req, resWrap);
}
}
Enjoy ;-)
--Nikolaos
Karen wrote:
> Hi,
>
> I know I can do a 302 redirect in a Stripes Action Bean like this:
>
> return new RedirectResolution(ExampleAction.class).addParameter("topic",
> 12);
>
> But this the default temporary redirect (301). For SEO reasons I like to
> send a permanent 302 redirect. But how?
>
> Should I make my own RedirectResolution? Or is there easier way?
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users