jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: JAX-RS 2.0 API for asynchronous server-side request processing

From: Bill Burke <bburke_at_redhat.com>
Date: Mon, 25 Jul 2011 08:31:03 -0400

In Resteasy, we do something much simpler than Atmosphere and the
app-developer decide how they want to handle responses. Atmosphere
seems a little ambitious to add to the spec as it looks like a full
messaging solution, but I'm willing to support the addition as it looks
kinda cool.

Here's what resteasy looks like.

1. All async methods must return void
2. A callback interface is injected.


@GET
public void get(final @Suspend(timeout=5) AsyncResponse async)
{

     Thread t = new Thread() {
         public void run() {
            Response r = Response.ok("hello", "text/plain");
            async.setResponse(r);
         }
     };
     t.start();
}

interface AsyncResponse {
    void setResponse(Response r);
}

There's really no other method because the user should be responsible
enough to send back a response. I could see a timeout method or suspend
method being added.

As for interceptor chains, MBR and filters are invoked for the initial
request. Outgoing MBW and filters happen when async.setResponse() is
invoked.

On 7/20/11 2:49 PM, Marek Potociar wrote:
> Hello experts,
>
> As announced last week, we have moved the asynchronous server-side processing API in front of some other topics in the
> schedule. I have wrote up a wiki page[1] discussing the problem domain in which I am also including some motivating
> examples, initial requirements and open topics to start the expert discussion.
>
> Please read through the wiki page[1] and send your thoughts to the EG list. Also, feel free to add new sections,
> reference links, requirements or open topics to the document, just make sure to mark the additions with your name.
>
> Let's shoot for finishing the first round of collecting the initial EG feedback on Friday (July 29) next week.
>
> Thank you,
> Marek
>
> [1] http://java.net/projects/jax-rs-spec/pages/AsyncServerProcessingModel

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com