| Author |
sendRedirect after flush without IllegalStateException.
|
Serghei Jelauc
Ranch Hand
Joined: Jul 24, 2002
Posts: 128
|
|
Hi all. It is very strange, but I do not have IllegalStateException in my servlet when I call res.sendRedirect("") method after flushing OutputStream. Here is my code: I've tryed it on Tomcat and on Weblogic - the result is the same - I have not been redirected, but I have downloaded file and there wasn't exception. Could someone explain me why? Thanks in advance? [ February 23, 2005: Message edited by: Serghei Jelauc ]
|
SCJP 1.4 <br />SCBCD 1.3<br />SCWCD 1.4
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
|
all i wanna say is, read the docs.
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Here it is. sendRedirect Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root. If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to. - it is from J2EE Docs
|
 |
Sim Kim
Ranch Hand
Joined: Aug 06, 2004
Posts: 268
|
|
|
See the tomcat logs . You will see the exception there .
|
 |
 |
|
|
subject: sendRedirect after flush without IllegalStateException.
|
|
|