On 08/07/2014 23:18, Marko Asplund wrote:
> Hi,
> 
> I'm just starting out with using the Servlet 3.1 asynchronous processing
> API.
> I use the API for generating response content, that can potentially be a
> slow process, in another thread.
> The code appears to be working, but since the specification contains many
> caveats, I'd like to try and verify correctness.
> 
> There's a couple of parts in particular that I'm wondering about:
> - what's the correct way to deliver error response to client? Can I just
> cast the response acquired from AsyncContext to HttpServletResponse and use
> the normal Servlet API mechanisms?

Personally, I'd do a dispatch since that completes the AsyncContext as
well. Your approach should work. Which is better is probably a matter of
style.

> - does the code contain thread-safety issues in particular related to the
> response object and OutputStream?

Ensuring thread-safe access of those objects is entirely an application
responsibility.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to