Package javax.servlet

Examples of javax.servlet.AsyncContext.complete()


          //Thread.sleep(2*1000);
          Thread.sleep(100);
          log.info("Writing data.");
          actx.getResponse().getWriter().write(
              "Output from background thread. Time:" + System.currentTimeMillis() + "\n");
          actx.complete();
        } catch (InterruptedException x) {
          log.error("Async2", x);
        } catch (IllegalStateException x) {
          log.error("Async2", x);
        } catch (IOException x) {
View Full Code Here


               setupResponse((ServerResponse) response);
               dispatcher.asynchronousDelivery(Servlet3AsyncHttpRequest.this, httpResponse, response);
            }
            finally
            {
               context.complete();
            }
         }
      };
      return asynchronousResponse;
   }
View Full Code Here

                if (supportSession()) {
                    AsyncContext asyncContext =
                            (AsyncContext) request.getSession().getAttribute("org.atmosphere.container.asyncContext");

                    if (asyncContext != null) {
                        asyncContext.complete();
                    }
                }

                Action nextAction = resumed(request, response);
                if (nextAction.type == Action.TYPE.SUSPEND) {
View Full Code Here

                        .getAttribute("org.atmosphere.container.asyncContext");
            }

            if (asyncContext != null && (config.getInitParameter(AtmosphereServlet.RESUME_AND_KEEPALIVE) == null
                    || config.getInitParameter(AtmosphereServlet.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
                asyncContext.complete();
            }
        }
        else {
            if (!actionEvent.isInScope()) {
                logger.debug("Already resumed or cancelled: event: {}", actionEvent);
View Full Code Here

    {
      AsyncContext context = _context;
      _context = null;
     
      if (context != null) {
        context.complete();
      }
    }

    @Override
    public void onComplete(AsyncEvent event) throws IOException
View Full Code Here

        try {
          mapper.writeValue(asyncContext.getResponse().getOutputStream(), newWorlds);
        } catch (IOException ex) {
          LOGGER.error("failed to get output stream", ex);
        }
        asyncContext.complete();

        LOGGER.debug("update done");
      }

      @Override
View Full Code Here

                            HttpServletResponse response = (HttpServletResponse) asyncContext.getResponse();
                            response.setStatus(SC_OK);
                            response.getWriter().printf("Hello Async world!");

                            asyncContext.complete();
                        }
                        catch (InterruptedException e)
                        {
                            Thread.currentThread().interrupt();
                        }
View Full Code Here

        asyncExecutor.schedule(LoginService.OVER_LIMIT_DELAY, new Runnable() {
          @Override
          public void run() {
            try {
              processRequest(httpRequest, httpResponse, request, false);
              asyncContext.complete();
            } catch (Exception e) {
              log.error("Unexpected error caught in async task", e);
            }
          }
        });
View Full Code Here

                if (supportSession()) {
                    AsyncContext asyncContext = (AsyncContext)
                            req.getSession().getAttribute("org.atmosphere.container.asyncContext");

                    if (asyncContext != null) {
                        asyncContext.complete();
                    }
                }

                Action nextAction = resumed(req, res);
                if (nextAction.type == Action.TYPE.SUSPEND) {
View Full Code Here

                                .getAttribute("org.atmosphere.container.asyncContext");
            }

            if (asyncContext != null && (config.getInitParameter(AtmosphereServlet.RESUME_AND_KEEPALIVE) == null
                    || config.getInitParameter(AtmosphereServlet.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
                asyncContext.complete();
            }
        } else {
            if (!actionEvent.isInScope() && logger.isLoggable(Level.FINE)) {
                logger.fine("Already resumed or cancelled " + actionEvent);
            }
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.