[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Need Help : Unable to write back a response error code from ReadListener#onError
From:       Adwait Kumar Singh <adwsingh () gmail ! com>
Date:       2023-10-31 22:25:48
Message-ID: CACRiEvmjMx+jEWVb5KVtAmfs2r-3s9F1d3jtuw7dCDshmXqq8A () mail ! gmail ! com
[Download RAW message or body]


Sorry for the wrong bug id. This is the one I filed,
https://bz.apache.org/bugzilla/show_bug.cgi?id=68037


On Tue, Oct 31, 2023 at 3:24 PM Adwait Kumar Singh <adwsingh@gmail.com>
wrote:

> AFAIK the response is not being committed.
>
> I created a bug for this with a reproducible test case,
> https://bz.apache.org/bugzilla/show_bug.cgi?id=54123
>
>
> On Tue, Oct 31, 2023 at 12:49 PM Mark Thomas <markt@apache.org> wrote:
>
>>
>>
>> On 30/10/2023 22:25, Adwait Kumar Singh wrote:
>> > 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.
>>
>> Has the response already been committed?
>>
>> If not, a minimal (ideally a single servlet) web application that
>> demonstrates the issue is often the easiest way for developers to
>> re-create the problem.
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic