File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect after flush without IllegalStateException.

 
Serghei Jelauc
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all i wanna say is, read the docs.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the tomcat logs . You will see the exception there .
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic