Package javax.servlet

Examples of javax.servlet.AsyncContext.createListener()


public class AsyncFooServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(QuxAsyncListener.class), req, resp);
        Executors.newSingleThreadExecutor().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    Timer.startNew(100l);
View Full Code Here


            return;
        }

        SimpleAsyncListener.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
View Full Code Here

            return;
        }

        SimpleAsyncListener.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
View Full Code Here

   
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
    {
        AsyncContext asyncContext = req.startAsync();
        MyAsyncListener listener = asyncContext.createListener(MyAsyncListener.class);

        PrintWriter writer = resp.getWriter();
        writer.println( "<html>");
        writer.println("<HEAD><link rel=\"stylesheet\" type=\"text/css\"  href=\"../stylesheet.css\"/></HEAD>");
        writer.println( "<body>");
View Full Code Here

            return;
        }

        statusBean.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
View Full Code Here

public class AsyncFooServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(QuxAsyncListener.class), req, resp);
        Executors.newSingleThreadExecutor().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(100l);
View Full Code Here

            return;
        }

        statusBean.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
View Full Code Here

            return;
        }

        statusBean.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
View Full Code Here

        String param = req.getParameter("action");
        String cid = req.getParameter("cid");

        statusBean.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(QuxAsyncListener.class));
        resp.setContentType("text/plain");

        if (TIMEOUT.equals(param)) {
            actx.setTimeout(150l);
        } else if (COMPLETE.equals(param)) {
View Full Code Here

            return;
        }

        SimpleAsyncListener.reset();
        final AsyncContext actx = req.startAsync();
        actx.addListener(actx.createListener(SimpleAsyncListener.class));
        resp.setContentType("text/plain");

        if (TEST_TIMEOUT.equals(test)) {
            actx.setTimeout(TIMEOUT);
        } else if (TEST_COMPLETE.equals(test)) {
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.