Package org.atmosphere.cpr.AtmosphereServlet

Examples of org.atmosphere.cpr.AtmosphereServlet.Action


     * {@inheritDoc}
     */
    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) {
            logger.debug("Suspending response: {}", res);
            suspend(ctx, action, req, res);
        } else if (action.type == Action.TYPE.RESUME) {
            logger.debug("Resuming response: {}", 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

        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) {
                logger.debug("Suspending response: {}", res);
            } else if (action.type == Action.TYPE.RESUME) {
                logger.debug("Resume response: {}", res);
                req.setAttribute(WebSocketSupport.WEBSOCKET_RESUME, "true");
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) {
                logger.debug("Suspending response: {}", res);
                suspend(action, req, res);
            } else if (action.type == Action.TYPE.RESUME) {
                logger.debug("Resuming response: {}", 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.debug("response wasn't suspended: {}", res);
                    return action;
                }

                latch.countDown();
                                                                 
                Action nextAction = resumed(req, res);
                if (nextAction.type == Action.TYPE.SUSPEND) {
                    logger.debug("Suspending after resuming response: {}", 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

        String connection = request.getHeader("Connection");
        if (!"Upgrade".equalsIgnoreCase(connection)) {
            return super.service(request, response);
        }
        else {
            Action action = suspended(request, response);
            if (action.type == Action.TYPE.SUSPEND) {
                logger.debug("Suspending response: {}", response);
            }
            else if (action.type == Action.TYPE.RESUME) {
                logger.debug("Resuming response: {}", response);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Action service(HttpServletRequest req, HttpServletResponse res)
            throws IOException, ServletException {
        Action action = suspended(req, res);
        if (action.type == Action.TYPE.SUSPEND) {
            logger.debug("Suspending response: {}", res);
        }
        else if (action.type == Action.TYPE.RESUME) {
            logger.debug("Resuming response: {}", res);

            Action nextAction = resumed(req, res);
            if (nextAction.type == Action.TYPE.SUSPEND) {
                logger.debug("Suspending after resuming response: {}", res);
            }
        }
        return action;
View Full Code Here

     * {@inheritDoc}
     */
    public Action service(HttpServletRequest req, HttpServletResponse response)
            throws IOException, ServletException {
        Continuation c = ContinuationSupport.getContinuation(req, null);
        Action action = null;

        if (!c.isResumed() && !c.isPending()) {
            // This will throw an exception
            action = suspended(req, response);
            if (action.type == Action.TYPE.SUSPEND) {
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) {
            Continuation c = ContinuationSupport.getContinuation(req, null);
            if (c != null) {
                c.resume();
            }
View Full Code Here

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

        Action action = null;
        // For now, we are just interested in CometEvent.READ
        if (event.getEventType() == EventType.BEGIN) {
            action = suspended(req, res);
            if (action.type == Action.TYPE.SUSPEND) {
                if (logger.isLoggable(Level.FINE)) {
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.