Asynchronous processor for servlets.
brew services start tomcat
- URLs
- Deploying
- From simple:Lifecycle
validate
clean
,package
- From tomcat7
tomcat7:redeploy-only
- From simple:Lifecycle
- Set up project - use FirstAsyncServlet as an example
- Mark the servlet as async
- Add a doGet
- Get the context
- Add a listener
- Call start
- Browse to
- All the above have logging which is at
/usr/local/opt/tomcat/libexec/logs/localhost.xxxx-xx-xx.log
- Show the log messages and the lack of a 'started' message
- Write another servlet (
DispatchAsyncServlet
)- Add a listener
- Dispatch to
\simple
- Show logging - should now see the start event as well
-
Explain the issues
- Still using threads, just in a different pool
- Not necessarily gaining anything
-
Create the
TransferDataAsyncServlet
- Explain that will use an 'Executor' to manage our own thread pool
-
Create the
ClientTransfer
class- Build this step by step
-
Create the
ControllerServlet
- Have this forward to the
index.jsp
page inWEB-INF
- Have this forward to the
-
Write the jquery code that hits the URL
$("#connect").click(function () { $.get("download").done(function (data) { console.log(data); }); });
-
Use Browser
- In browser browse to
- Show console where the output appears