Hi

----- Original Message -----
From: "Ronald Wildenberg" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Wednesday, March 10, 2004 3:00 PM
Subject: RE: HttpServletResponse.sendRedirect() closes the stream


> > -----Oorspronkelijk bericht-----
> > Van: suviswan [mailto:[EMAIL PROTECTED]
> > Verzonden: woensdag 10 maart 2004 10:20
> > Aan: Tomcat Users List
> > Onderwerp: HttpServletResponse.sendRedirect() closes the stream
> >
> >
> > Hi
> >         I am using Tomcat 4.1.29. When i do
> > HttpServletResponse.sendRedirect() inside my servlet doGet(), it
> > automatically closes the stream
> >         So when i call the real close() function it throws IOException
> >
> >                 java.io.IOException: The stream has been closed
> >                 at
> > org.apache.catalina.connector.ResponseStream.close(ResponseStr
> > eam.java:219)
> >
> >         Please let me know how to solve on this.
>
>
> The easiest way would be not to call close() on the response's output
> stream. Is there a reason you need to call close()?
>
> The servlet spec says that sendRedirect has the side effect of committing
> the response and terminating it. If the response is terminated, its
> related OutputStream is closed, so it can not be closed again.
>

There is no need to close(). We have a servlet code which is based on 2.1
spec and we are moving to 2.3 spec.
The code worked fine in 2.1 and we thought it will work fine in 2.2.

The code worked when we commented the close() call. Thanks for the help.

Regards
Surendra


>
> >
> > Thanks
> > Surendra
> >
>
> Regards,
> Ronald.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to