What is the default behavior of REST web services - synchronous or asynchronous ?
If it's synchronous then can we create asynchronous ?
"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:
@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.
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.
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 .
Yes you can have Asynchronous as well as Synchronous Web Service. You can use any of the frameworks like Restlet, JAXB, JAX-RS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.