Hi,

I am using the async Servlet API and NIO, by setting a ReadListener.

In the onError of the ReadListener, I am catching a SocketTimeoutException
and trying to send back an error code 408. Here is the simplified example
of what I am trying to do,

@Override
> public void onError(Throwable failure) {
>     if(failure instanceof SocketTimeoutException) {
>         response.sendError(408);
>         request.getAsyncContext().complete();
>     }
> }
>
>
However, Tomcat just refuses to send back the error I want and instead just
closes the connection. Am I missing something trivial or is this supposed
to be achieved in a different way?

I am using Tomcat 9.0.82 and the Http11NioEndpoint.


Thanks,
Adwait.

Reply via email to