Donghwan,
There is no support for non-blocking I/O in JAX-RS 2.0. It is one of the features planned for JAX-RS 2.1 in Java EE 8. At this point, if you're interested in a portable solution, you'd need to build this on top of Servlet 3.1.
Hope this helps.
-- Santiago
On Nov 17, 2014, at 4:20 AM, Donghwan Kim <flowersinthesand_at_gmail.com> wrote:
> Hi,
>
> Originally, I posted this question on StackOverflow but couldn't get an answer:
> http://stackoverflow.com/questions/26955663/handling-http-request-response-exchange-asynchronously-in-jax-rs
>
> If I write what I need as propositions:
> A server should be able to read chunk from request body without blocking every time a client writes and flushes that chunk like Servlet 3.1's ServletInputStream#setReadListener.
> A server should be able to write and flush chunk multiple times to response body without blocking like Servlet 3.0's HttpServletRequest#startAsync.
> With JAX-RS 2.0, I couldn't meet them. For the first one, I couldn't find such support like ReadListener, and for the second one, I found AsyncResponse but its API doesn't allow writing chunk multiple times.
>
> Is there any idea or hack to meet them with only JAX-RS API not using implementation-specific features? I tried ContainerRequestFilter, ContainerResponseFilter, ReaderInterceptor and WriterInterceptor, but they didn't help.
>
> Thanks,
>
> --Donghwan