You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by shriny <sh...@gmail.com> on 2008/12/02 19:45:22 UTC

Asynchronous Restful web service

I am trying to build a cxf based asynchronous restful web service, i saw the
polling ayns web service on the site but couldn't find asynchronous rest
sample

Have any tried this ?


-- 
View this message in context: http://www.nabble.com/Asynchronous--Restful-web-service-tp20798394p20798394.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Asynchronous Restful web service

Posted by Sergey Beryozkin <se...@progress.com>.

> Hi
>
> For JAXRS you can use a number of approaches.
> 1. Continuations - I've just posted a blog entry [1] showing one way how to do it - the formatting is not good, sorry about it, 
> could not figure out quickly how to show Java code properly in an HTML page in a blogger blog entry. If someone knows then please 
> send me an email offline - would be appreciated.

<OT>
With some great help from Glen [2] I heroically :-) managed to format the code a bit and squeze it into the page, still the long way 
to go, but I'm on the right path, next task is to master handling blogger HTML templates :-)
</OT>

I've updated the code a bit and added some additional explanations too.

Cheers, Sergey

>
>
> [1] http://sberyozkin.blogspot.com/2008/12/continuations-in-cxf.html

[2] http://www.jroller.com/gmazza/ 



Re: Asynchronous Restful web service

Posted by Sergey Beryozkin <se...@progress.com>.
Hi

For JAXRS you can use a number of approaches.
1. Continuations - I've just posted a blog entry [1] showing one way how to do it - the formatting is not good, sorry about it, 
could not figure out quickly how to show Java code properly in an HTML page in a blogger blog entry. If someone knows then please 
send me an email offline - would be appreciated.

That's the only support for asynchronous services that we have in JAXRS at the moment. I'm wondering, can we reuse 
AsynchronousHandlers used by JAXWS somehow - need to look into it

The net effect is that after continuation.suspend() is called a transport  thread will be immediately released and a pending request 
will be put in a request queue. When your asynchronous activity is completed, it will call continuation.resume() and the request 
will come back into your method. See this test [2] for another example

2. Just provide a response URI as part  of your invocation (either as a query parameter or as part of the body when applicable) and 
reply to it whenever the response is ready

3. If applicable, consider returning a resource URI which will represent an asynchromous activity and which a client will poll for 
for the results...

Cheers, Sergey

[1] http://sberyozkin.blogspot.com/2008/12/continuations-in-cxf.html
[2] http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookContinuationStore.java

>
> I am trying to build a cxf based asynchronous restful web service, i saw the
> polling ayns web service on the site but couldn't find asynchronous rest
> sample
>
> Have any tried this ?
>
>
> -- 
> View this message in context: http://www.nabble.com/Asynchronous--Restful-web-service-tp20798394p20798394.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>