>>> Pankaj C Rajankar <[EMAIL PROTECTED]> 01-Feb-01 9:51:38
PM >>>

>In the catch block I have the following:
<snip/>
>I get an error, connection reset by peer, on execution.

You've got the close() before the sendRedirect().

You probably need to have it the other way round:

{
ServletInputStream in = request.getInputStream();
in.skip(lUploadSize);
response.sendRedirect("/error.htm");
in.close();
}


a call to close() will close the stream and therefore the socket
connection. The browser will think "oh dear the connection has closed"
and give you that message.

As a general note you probably don't need the close at all with a
sendRedirect()... most engines will take over stream handling for
you.

Some people believe that you should never have a servlet close() the
stream because the servlet hasn't opened it. But IMHO close()ing makes
the code more specific and engines should handle it properly.


Nic

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to