cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <>
Subject Re: Permanent Redirects
Date Mon, 23 Jun 2003 22:46:59 GMT
on 6/23/03 2:10 AM Upayavira wrote:

> I've worked out how I'd like to implement permanent redirects. I'd appreciate 
> comments as to whether this approach is okay. I would rather have comments 
> before just doing it...
> Add to o.a.c.environment:
> public interface PermanentRedirector {
>     void redirectPermanently(boolean sessionmode, String url) throws IOException, 
> 		ProcessingException;
> }
> Make HttpEnvironment and HttpResponse implement this interface. 
> HttpEnvironment.redirectPermanently() calls HttpResponse.redirectPermanently(). 
> HttpResponse.redirectPermanently() sets the status to 
> SC_MOVED_PERMANENTLY and sets a 'location' header in the response.
> Then the RedirectToNodeBuilder needs to be extended to handle a 'permanent' 
> attribute for the <map:redirect-to> node.
> Finally, in RedirectToURINode.invoke(), test to see if both the permanent attribute 
> has been set, and the current Redirector implements PermanentRedirector, and if 
> so, call redirectPermanently() instead of just redirect().
> I think that does it. Am I breaking any contracts, or extending the sitemap 
> language when I shouldn't be?
> So, why permanent redirects?
> A 301 (Permanent Redirect) informs the user agent that a URL has changed
> permanently, and to use the new one form there onwards. Caching of the new
> page is as usual.
> A 302 (Temporary Redirect) informs the user agent and any proxy servers in
> the loop that a URL has changed temporarily, and may change again. The
> user agent and any proxy servers will _not_ cache the new page. So 302's put an 
> extra load on the server and all elements downstream of it as the pages are not 
> cached.
> And that's why 301s are better if the page has moved permanently, but 302s
> are fine for a temporary change.

+1 for me.


View raw message