/AsyncNew

Asynchronous processor for servlets

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

AsyncNew

Asynchronous processor for servlets.

Deploy

  1. brew services start tomcat
  2. URLs
    1. http://localhost:8080/simple/anything.do
    2. http://localhost:8080/simple/home?name=kevin
  3. Deploying
    1. From simple:Lifecycle
      1. validate clean, package
    2. From tomcat7
      1. tomcat7:redeploy-only

Simple Async

  1. Set up project - use FirstAsyncServlet as an example
    1. Mark the servlet as async
    2. Add a doGet
    3. Get the context
    4. Add a listener
    5. Call start
    6. Browse to
  2. All the above have logging which is at /usr/local/opt/tomcat/libexec/logs/localhost.xxxx-xx-xx.log
    1. Show the log messages and the lack of a 'started' message

Dispatch

  1. Write another servlet (DispatchAsyncServlet)
    1. Add a listener
    2. Dispatch to \simple
    3. Show logging - should now see the start event as well

More Realistic

  1. Explain the issues

    1. Still using threads, just in a different pool
    2. Not necessarily gaining anything
  2. Create the TransferDataAsyncServlet

    1. Explain that will use an 'Executor' to manage our own thread pool
  3. Create the ClientTransfer class

    1. Build this step by step
  4. Create the ControllerServlet

    1. Have this forward to the index.jsp page in WEB-INF
  5. Write the jquery code that hits the URL

    $("#connect").click(function () {
      $.get("download").done(function (data) {
        console.log(data);
      });
    });
  6. Use Browser

    1. In browser browse to
    2. Show console where the output appears