restwebsocketjerseyatmosphere

How to invoke a conventional REST-RPC call with the Atmosphere framework?


How do I send POST/PUT/DELETE calls to a rest source using Atmosphere 1.1.0+ in a conventional RPC manner? (You are guessing right, I want to employ pub/sub and RPC style in my project)

serverside: register a @Path (e.g. /member), mark with @POST/@PUT/@DELETE, process the method body and return the value. Seems straight forward. Even with JSON en-/decoding.

clientside: How would you kick a POST request with the wasync library? All atmosphere examples use "GET" and recommended to use GET only. Why is that?

RequestBuilder request = client.newRequestBuilder().method(Request.METHOD.GET).uri("/member") 

Can one expect this synchronous server response when invoking the fire method? e.g.

Future future = socket.fire(myMemberObject)

Thank you for hints and comments on this approach (also thoights on pairing RPC and PubSub are welcome).


Solution

  • wAsync is using POST once the connection is established. wAsync is asynchronous by nature so you need to use Latch if you want to make it blocking, or use AsyncHttpClient with Future.