Reputation: 10303
I am using Jetty 8
in blocking I/O mode. The servlet doPost
reads the request content from the request InputStream
(which is actually an instance of Jetty HttpInput
).
What if a client sends a very large request and does it very slowly ? Obviously, it will take a lot of time to read the request. So, I would like to cancel the reading after a few seconds and send an error response to the client. How can I do that without much changes i.e. using Jetty
with blocking I/O and without continuation
?
Upvotes: 1
Views: 969
Reputation: 49462
Use HttpServletResponse.sendError(-1)
to terminate the connection.
Write a ServletFilter that does the detection of the slow request. When you determine it is slow, ...
Also, look into the QoSFilter, it does a lot of this kind of stuff already.
Upvotes: 2