Reputation: 2332
Recently I have configured my Servlet for asynchronous processing with the below configuration
<async-supported>true</async-supported>
My question is, is this change transparent to the HTTP client? My client is not a web browser. It is a hardware device which makes HTTP requests and I have no control over the client functionality.
P.S - The question arises from the fact that I have recently heard about asychronous http clients.
Upvotes: 4
Views: 191
Reputation: 4233
The simple answer is NO.
The new async mechanism is only provided to better utilize threads on the server machine. As far as the client is concerned, there is no change.
Even in earlier days, in case you use AJAX, the client processes requests in asynchronous fashion using callbacks. So, asynchronous clients came first. Server can also use async mechanism now if it wants to do time-consuming operations on receiving http-requests from client.
Note that, even in the async world, the server can't do way-too-time-consuming stuff because the clients may not wait that long for the server to respond.
For information of how async works on the server side here is a link: I don't understand Async support in servlets 3.0 API
Edit:
With async support, since servers can now put a response on hold and do other useful stuff, you could design client-server applications where the client asks server to "respond later when something interesting happens". So, the AJAX request can be open for 5 to 10 minutes and if something happens in that time, the server could respond (and close the connection). During this 5 minute window, there wouldn't be a Thread blocked-up in the server.
In other words, people could design applications based on late-responding server API. Here is some more information on this technique: Ajax Long Polling
Upvotes: 3