Reputation: 967
What is the default behavior of REST web services - synchronous or asynchronous?
If it's synchronous then can we create asynchronous?
Upvotes: 38
Views: 69709
Reputation: 18810
I think this might be a good help for you to understand the RESTful web services in Java:
You can control the client being synchronous or asynchronous from the client side. An example - using AJAX.
Upvotes: 3
Reputation: 4877
@Thrustmaster has explained it well. I just wanted to add a point to make it sound simpler.
REST web service is nothing but an HTTP call. You make a HTTP request to a URL and get a HTTP response back. How to handle the request and response is up to the caller.
Upvotes: 5
Reputation: 44444
"Synchronous" or "Asynchronous" is the behaviour of the client that is requesting the resource. It has nothing to do with REST webservice, its structure, or the supporting server.
Synchronous behaviour:
Asychronous behaviour:
Upvotes: 66
Reputation: 938
Yes you can have Asynchronous as well as Synchronous Web Service. You can use any of the frameworks like Restlet, JAXB, JAX-RS.
Upvotes: 1
Reputation: 8401
REST services has not nothing to do with being Synchronous or asynchronous.
Client Side: Clients calling must support asynchronous to achieve it like AJAX in browser.
Server Side: Multi- Thread environment / Non blocking IO are used to achieve asynchronous service.
Upvotes: 3