Package javax.servlet

Examples of javax.servlet.AsyncContext.complete()


                            HttpServletResponse resp =
                                    (HttpServletResponse) actxt.getResponse();
                            resp.sendError(status, ERROR_MESSAGE);
                            // Complete so there is no delay waiting for the
                            // timeout
                            actxt.complete();
                        } catch (IOException e) {
                            // Ignore
                        }
                    }
                });
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

                        Thread.sleep(5000);
                        resp.setHeader("A", "xyz");
                        resp.setContentType("text/plain");
                        resp.setContentLength("OK".getBytes().length);
                        resp.getWriter().print("OK");
                        ctx.complete();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
View Full Code Here

                    suspendableService(srad, res);
                } catch (Exception ex) {
                    log("Exception in fiber servlet", ex);
                } finally {
                    if (req.isAsyncStarted())
                        ac.complete();
                    currentAsyncContext.set(null);
                }
            }
        }).start();
    }
View Full Code Here

                    } catch (SuspendExecution e) {
                        throw new AssertionError(e);
                    }
                } else {
                    out.close();
                    ctx.complete();
                }
                return true;
            } catch (IOException ex) {
                request.getServletContext().log("IOException", ex);
                ctx.complete();
View Full Code Here

                    ctx.complete();
                }
                return true;
            } catch (IOException ex) {
                request.getServletContext().log("IOException", ex);
                ctx.complete();
                this.exception = ex;
                return false;
            }
        }
View Full Code Here

        @Override
        public void complete() {
            final AsyncContext asyncContext = asyncContextRef.getAndSet(null);
            if (asyncContext != null) {
                asyncContext.complete();
            }
        }
    }
}
View Full Code Here

                throws ServletException, IOException {
           
            AsyncContext actxt = req.startAsync();
            resp.setContentType("text/plain");
            resp.getWriter().print("OK");
            actxt.complete();
        }
    }

}
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

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.