April 2018
Intermediate to advanced
382 pages
10h 11m
English
From the all important things here, we should start with a simple annotation:
asyncSupported = true
This will tell the application server that this very servlet supports asynchronous features. By the way, you will need this in the whole servlet chain (including filters, if there are any), otherwise application server will not work.
As the servlets are instantiated by the server, we can inject other context members on it, such as our stateless bean:
@Injectprivate UserBean userBean;
The main servlet method holds the actual request and response references, and the request will give us the context reference to the async API:
AsyncContext ctx = req.startAsync();
Then, you can execute your previous blocking function in a non-blocking ...
Read now
Unlock full access