This webpage has a redirect loop

372 views
Skip to first unread message

Bill

unread,
May 5, 2011, 5:10:53 AM5/5/11
to Google App Engine
Hello.

I'm new to GAE. And somewhat old with web development.

I was trying to do a redirect - to a jsp page - from my servlet class
but keep getting the error message "The webpage at http://localhost:8888/my_clock.jsp
has resulted in too many redirects".

My servlet method simply calls resp.sendRedirect("/my_clock.jsp"). And
the jsp file is saved directly under the war/ directory. Spitting out
html using PrintWriter's out.println() method however works fine.

Please what am I doing wrong?

My web.xml looks like this:

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>clock</servlet-name>
<servlet-class>clock.ClockServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>clock</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>

Stephen Johnson

unread,
May 6, 2011, 1:59:42 PM5/6/11
to google-a...@googlegroups.com
Your URL pattern /* is set to send all requests to your ClockServlet so it keeps redirecting to your jsp page which just matches your servlet pattern so your servlet just keeps getting called again and again and again....  You probably want to do a server side redirect using a RequestDispatcher and not a client-side redirect like you are currently doing. 
Stephen


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


Reply all
Reply to author
Forward
0 new messages