PDA

View Full Version : The URL has moved here


hff135
08-12-2009, 03:45 PM
When I do a response.sendRedirect("new_page.html"), I get a page that has the content "The URL has moved here" and the word "here" is hyperlinked to the new page.

I've tried a number of different things and I get this same error every time I do a redirect.

ferg
08-12-2009, 09:13 PM
The send redirect should send a 302 HTTP response with the Location header with the new address and a body with the contents that you're seeing. Normally, the browser should make a second request immediately.

hff135
08-12-2009, 10:20 PM
I made a page which is the following:

<%
response.sendRedirect("/new_page.html");
%>


I don't get a 302 back from Resin. Instead, it sends the following:

HTTP/1.0 200 OK
Server: Resin/3.1.9
Cache-Control: no-cache
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Set-Cookie: JSESSIONID=abcFJs9OnfhKs6KN5upms; path=/
Content-Length: 79
Date: Wed, 12 Aug 2009 15:57:00 GMT

The URL has moved <a href="http://localhost:56/new_page.html">here</a>

hff135
08-13-2009, 04:37 PM
Isn't the sendRedirect() method supposed to automatically set the response code to 302 and the Location header? Does anyone know why it's not doing it for me?
-H