Package javax.servlet

Examples of javax.servlet.AsyncContext.complete()


            catch (Throwable t2) {
              log.debug("Failed to write exception to dead client", t2);
            }
          }
          finally {
            asyncContext.complete();
          }
        }
      });
      writer.flush();
    }
View Full Code Here


    final AsyncContext asyncContext = request.startAsync();
    asyncContext.addListener(new AsyncListener() {
      @Override
      public void onTimeout(AsyncEvent event) throws IOException {
        poll(queue, asyncContext);
        asyncContext.complete();
      }
     
      @Override
      public void onComplete(AsyncEvent event) throws IOException {}
     
View Full Code Here

          catch (IOException e) {
            throw new RuntimeException("Failed to write exception to output stream", e);
          }
        }
        finally {
          asyncContext.complete();
        }
      }
    });
  }
View Full Code Here

    final AsyncContext asyncContext = request.startAsync();
    asyncContext.addListener(new AsyncListener() {
      @Override
      public void onTimeout(AsyncEvent event) throws IOException {
        poll(queue, asyncContext);
        asyncContext.complete();
      }

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

          catch (IOException e) {
            throw new RuntimeException("Failed to write exception to output stream", e);
          }
        }
        finally {
          asyncContext.complete();
        }
      }
    });
  }
View Full Code Here

    if (req.isAsyncStarted()) {
      AsyncContext async = req.getAsyncContext();

      if (async != null)
        async.complete();
    }

    if (response instanceof HttpServletResponseImpl) {
      HttpServletResponseImpl resFacade = (HttpServletResponseImpl) response;
      resFacade.killCache();
View Full Code Here

           
            AsyncContext actxt = req.startAsync();
            actxt.setTimeout(3000);
            resp.setContentType("text/plain");
            resp.getWriter().print("OK");
            actxt.complete();
        }
    }

    public void testTimeoutListenerComplete() throws Exception {
        doTestTimeout(true, null);
View Full Code Here

                public void run() {
                    try {
                        Thread.sleep(3 * 1000);
                        asyncContext.getResponse().getWriter().write(
                                "Runnable-");
                        asyncContext.complete();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
View Full Code Here

            AsyncContext actxt = req.startAsync();
            actxt.setTimeout(3000);
            resp.setContentType("text/plain");
            resp.getWriter().print("OK");
            actxt.complete();
        }
    }

    @Test
    public void testTimeoutListenerCompleteNoDispatch() throws Exception {
View Full Code Here

                public void run() {
                    try {
                        Thread.sleep(THREAD_SLEEP_TIME);
                        asyncContext.getResponse().getWriter().write(
                                "Runnable-");
                        asyncContext.complete();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
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.