Package javax.servlet

Examples of javax.servlet.AsyncContext.dispatch()


            Thread.currentThread().setName("Async0-Thread");
            log.info("Putting AsyncThread to sleep");
            //Thread.sleep(2 * 1000);
            Thread.sleep(100);
            log.info("Dispatching");
            actx.dispatch();
          } catch (InterruptedException x) {
            log.error("Async1", x);
          } catch (IllegalStateException x) {
            log.error("Async1", x);
          }
View Full Code Here


          Thread.currentThread().setName("Async1-Thread");
          log.info("Putting AsyncThread to sleep");
          //Thread.sleep(2 * 1000);
          Thread.sleep(100);
          log.info("Dispatching to " + path);
          actx.dispatch(path);
        } catch (InterruptedException x) {
          log.error("Async1", x);
        } catch (IllegalStateException x) {
          log.error("Async1", x);
        }
View Full Code Here

public class Async3 {

    public void index(final HttpServletRequest req) {
        final AsyncContext actx = req.startAsync();
        actx.setTimeout(30*1000);
        actx.dispatch("/jsp/async/async3.jsp");
    }
   

}
View Full Code Here

      if (! _isWake.getAndSet(true)) {
        AsyncContext context = _context;
       
        if (context != null) {
          try {
            context.dispatch();
          } catch (Exception e) {
            log.log(Level.FINER, e.toString(), e);
           
            return false;
          }
View Full Code Here

                            {
                                // Simulate a long running process...
                                Thread.sleep(1000);

                                asyncContext.getRequest().setAttribute("msg", "Hello Async world!");
                                asyncContext.dispatch();
                            }
                            catch (InterruptedException e)
                            {
                                Thread.currentThread().interrupt();
                            }
View Full Code Here

            }
            Runnable run = new Runnable() {
                @Override
                public void run() {
                    if (iter > 0) {
                        ctxt.dispatch("/stage1?" + ITER_PARAM + "=" + iter +
                                "&" + DISPATCH_CHECK + "=y");
                    } else {
                        ctxt.dispatch("/stage2");
                    }
                }
View Full Code Here

                public void run() {
                    if (iter > 0) {
                        ctxt.dispatch("/stage1?" + ITER_PARAM + "=" + iter +
                                "&" + DISPATCH_CHECK + "=y");
                    } else {
                        ctxt.dispatch("/stage2");
                    }
                }
            };
            if ("y".equals(req.getParameter("useThread"))) {
                new Thread(run).start();
View Full Code Here

            Runnable run = new Runnable() {
                @Override
                public void run() {
                    if (first) {
                        ctxt.dispatch("/stage1");
                    } else {
                        ctxt.dispatch("/stage2");
                    }
                }
            };
View Full Code Here

                @Override
                public void run() {
                    if (first) {
                        ctxt.dispatch("/stage1");
                    } else {
                        ctxt.dispatch("/stage2");
                    }
                }
            };
            if ("y".equals(req.getParameter("useThread"))) {
                new Thread(run).start();
View Full Code Here

            ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.submit(new Runnable() {

                @Override
                public void run() {
                    async.dispatch("/ServletC");
                }
            });
            executor.shutdown();
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.