Package org.atmosphere.cpr.AtmosphereServlet

Examples of org.atmosphere.cpr.AtmosphereServlet.Action


    @Override
    public Action cancelled(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        Action action =  super.cancelled(req,res);
        if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) {
           CometEvent event = (CometEvent) req.getAttribute(COMET_EVENT);
           if (event == null) return action;
           resumed.offer(event);
           event.close();
View Full Code Here


     * {@inheritDoc}
     */
    public Action service(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        Action action = suspended(req, res);
        if (req.getAttribute(WebSocketSupport.WEBSOCKET_SUSPEND) == null) {
            if (action.type == Action.TYPE.SUSPEND) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Suspending" + res);
                }
                suspend(action, req, res);
            } else if (action.type == Action.TYPE.RESUME) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Resuming" + res);
                }

                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) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.fine("Suspending after Resuming" + res);
                        suspend(action, req, res);
                    }
View Full Code Here

        // Comet is not enabled.
        if (event == null) {
            throw unableToDetectComet;
        }

        Action action = null;
        // For now, we are just interested in HttpEvent.REA
        if (event.getType() == HttpEvent.EventType.BEGIN) {
            action = suspended(req, res);
            if (action.type == Action.TYPE.SUSPEND) {
                if (logger.isLoggable(Level.FINE)) {
View Full Code Here

    @Override
    public Action cancelled(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        Action action =  super.cancelled(req,res);
        if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) {
           HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT);
           if (event == null) return action;
           resumed.offer(event);
           event.close();
View Full Code Here

        String connection = req.getHeader("Connection");
        if (connection == null || !connection.equalsIgnoreCase("Upgrade")){
           return super.service(req,res);
        } else {
            Action action = suspended(req, res);
            if (action.type == Action.TYPE.SUSPEND) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Suspending " + res);
                }
            } else if (action.type == Action.TYPE.RESUME) {
View Full Code Here

     */
    public Action service(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        CometContext ctx = CometEngine.getEngine().getCometContext(atmosphereCtx);
        Action action = suspended(req, res);
        if (action.type == Action.TYPE.SUSPEND) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Suspending" + res);
            }
            suspend(ctx, action, req, res);
View Full Code Here

    @Override
    public Action cancelled(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        Action action =  super.cancelled(req,res);
        if (req.getAttribute(MAX_INACTIVE) != null && Long.class.cast(req.getAttribute(MAX_INACTIVE)) == -1) {
            resume(req,CometEngine.getEngine().getCometContext(atmosphereCtx));
        }
        return action;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Action service(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {
        Action action = null;

        Continuation c = ContinuationSupport.getContinuation(req);

        if (c.isInitial()) {
            action = suspended(req, res);
View Full Code Here

     * {@inheritDoc}
     */
    public Action service(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {

        Action action = null;
        try {
            action = suspended(req, res);
            if (action.type == Action.TYPE.SUSPEND) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Suspending" + res);
                }
                suspend(action, req, res);
            } else if (action.type == Action.TYPE.RESUME) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.fine("Resuming" + res);
                }

                int latchId = (req.getAttribute(LATCH) == null ? 0 : (Integer)req.getAttribute(LATCH));
                if (req.getSession(true).getAttribute(LATCH) != null) {
                    latchId = (Integer) req.getSession(true).getAttribute(LATCH);
                }
                CountDownLatch latch = latchs.get(latchId);

                if (latch == null && req.getAttribute(AtmosphereResourceImpl.PRE_SUSPEND) == null) {
                    logger.fine("That response " + res + " wasn't suspended.");
                    return action;
                }

                latch.countDown();
                                                                 
                Action nextAction = resumed(req, res);
                if (nextAction.type == Action.TYPE.SUSPEND) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.fine("Suspending after Resuming" + res);
                        suspend(action, req, res);
                    }
View Full Code Here

        if (req.getAttribute(LATCH) != null) {
            latchId = (Integer) req.getAttribute(LATCH);
        }
        CountDownLatch latch = latchs.remove(latchId);
        Action a = super.cancelled(req,res);
        latch.countDown();
        return a;       
    }
View Full Code Here

TOP

Related Classes of org.atmosphere.cpr.AtmosphereServlet.Action

Copyright © 2018 www.massapicom. 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.