jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: AsyncIO from ontimeout

From: Stuart Douglas <sdouglas_at_redhat.com>
Date: Fri, 28 Oct 2016 07:58:02 +1100

+1

This sounds reasonable.

Stuart

On Thu, Oct 27, 2016 at 4:53 PM, Greg Wilkins <gregw_at_webtide.com> wrote:
> All,
> we've just realized that the way the AsyncListener onTimeout (and probably
> onError) method(s) are specified precludes an implementation from writing a
> response asynchronously.
>
> The AsyncContext javadoc says:
>
>> In the event that an asynchronous operation has timed out, the container
>> must run through these steps:
>> 1. Invoke, at their onTimeout method, all AsyncListener instances
>> registered with the ServletRequest on which the asynchronous operation was
>> initiated.
>> 2. If none of the listeners called complete or any of the dispatch
>> methods, perform an error dispatch with a status code equal to
>> HttpServletResponse.SC_INTERNAL_SERVER_ERROR.
>> 3. If no matching error page was found, or the error page did not call
>> complete or any of the dispatch methods, call complete.
>
>
>
> So once onTimeout is called, the implementation can only complete
> (presumably after writing a blocking response) or dispatch, which would then
> have to do another startAsync cycle if the response was to be written using
> async IO.
>
> I'm wondering if we should allow AsyncContext.setTimeout to be called to
> indicate that the current async cycle should continue with the new timeout.
> This would allow an response to be written asynchronously.
>
> --
> Greg Wilkins <gregw@webtide.com> CTO http://webtide.com