users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] AsyncResponse should be able to accept responses immediately

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 27 Sep 2012 13:56:27 +0100

Hi,

I can see AsyncResponse.resume throws IllegalStateException if the
invocation has not been suspended.

IMHO it is too much of a restriction, possibly an implementation
specific one.

IMHO, the following should work

@GET
void getIt(AsyncResponse response) {
    response.resume(myObject);
}

if 'myObject' happens to be available immediately.
The runtime has to suspend only after "getIt" returns, but only if no
response object is already available.

Thoughts ?

Sergey