Thank you very much Bill for the useful update!
There is probably a typo below, "request.getOutputStream().close()"
would be request.getInputStream() or response.getOutputStream().
So, do you mean the request.getInputStream().close() actually closes the
underlying connection stream or that the request.getInputStream() will
be closed by setting a status code on the response (or similarly sending
an error through the response) ?
Thanks,
Mauri
Bill Barker wrote:
However, in TC 6.0.19 the code below will work (however, the
request.getOutputStream().close() will still have no effect, it will trigger
because of the status code). Also,
response.setStatus(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE) will
work as well.
"Bill Barker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
There is currently no way to do this in Tomcat. Tomcat will always drain
the input stream, even in cases like this where it should know better.
"Maurizio Melato" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello!
is there a way to dispose an HttpServletRequest closing the underlying
inputstream without consuming the entire HTTP client stream?
Before answering request.getInputStream().close() let me explain the
scenario ;)
The scenario involves a client application executing a potentially big
HTTP chunked POST (100mb or even gb) and the server, for some reason,
may want to close the connection after a while.
The Server code closing the request is:
------
try {
request.getInputStream().close();
}catch(IOException ignore) {}
}
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Error");
response.flushBuffer();
}catch(IOException ignore) {}
try {
response.getOutputStream().close();
} catch (IOException e) {}
------
I logged each step and I know for sure these operations are actually
executed.
After the Server performs the operations above I would expect the client
to get an IOException while still writing the request body stream but
this does not happen!
The client posts all the request stream (consuming resources on the
client machine, etc, etc..) till the end while Tomcat seems to simply
discard those data without closing the underlying connection.
Do you know if this behaviour is supposed to be correct?
Any workaround to force a different one?
Thanks in advance for your availability!
Best regards,
Maurizio
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]