tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Yunusov <>
Subject Re: dispatcher.forward(), but with new URL
Date Fri, 10 Jan 2003 20:54:03 GMT
On Friday 10 January 2003 03:42 pm, Erik Price wrote:
> Paul Yunusov wrote:
> > sendRedirect() in HttpServletResponse will send an HTTP redirect response
> > to the client so the client's browser itself makes a new request to the
> > new URL (main.jsp in your case). It results in the new URL being shown in
> > the browser's address field.
> Paul, this is exactly what I was looking for!  Thank you.  My only fear
> is that if the client User Agent doesn't respect the HTTP Redirect (say
> it is a malicious Perl script or something), does the servlet know not
> to transmit any further data?  Or should I manually call System.exit()
> after the response.sendRedirect() call?

Well, the API docs say "After using this method, the response should be 
considered to be committed and should not be written to" so I guess the 
developer rather than the servlet should know not to transmit any further 
data from the servlet.

Definitely no System.exit() in servlets as that would theoretically attempt to 
shut down the Tomcat process itself but I don't know anything about any 
practical repercussions. You could try that and let us know what happened. 

> > Note that the original request's parameters, which were sent to the
> > servlet, are lost but check the sendRedirect()'s documentation for more
> > details.
> That is okay, I will be storing data in the session in the LoginServlet
> so the original parameters can be dropped.  Thank you very much again.

Yes, holding the data in the session is what I thought you'd do, and I am glad 
I could be of any help.

> Erik


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message