Package org.atmosphere.cpr.AtmosphereServlet

Examples of org.atmosphere.cpr.AtmosphereServlet.Action


        String upgrade = req.getHeader("Connection");
        if (upgrade != null && upgrade.equalsIgnoreCase("Upgrade") && !supportWebSocket()) {
            res.setStatus(501);
            res.addHeader("X-Atmosphere-error","Websocket protocol not supported");
            res.flushBuffer();
            return new Action();
        }

        if (config.handlers().isEmpty()) {
            logger.error("No AtmosphereHandler found. Make sure you define it inside META-INF/atmosphere.xml");
            throw new ServletException("No AtmosphereHandler found. Make sure you define it inside META-INF/atmosphere.xml");
View Full Code Here


     * @throws IOException
     * @throws ServletException
     */
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        Action a = as.doCometSupport((HttpServletRequest) request, (HttpServletResponse) response);
        if (a == null || a.type != Action.TYPE.SUSPEND) {
            chain.doFilter(request, response);
        }
    }
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) {
            logger.debug("Suspending response: {}", res);
            suspend(ctx, action, req, res);
        }
        else if (action.type == Action.TYPE.RESUME) {
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

        // 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) {
                logger.debug("Suspending 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) {
           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 request, HttpServletResponse response)
            throws IOException, ServletException {

        Action action = suspended(request, response);
        if (request.getAttribute(WebSocketSupport.WEBSOCKET_SUSPEND) == null) {
            if (action.type == Action.TYPE.SUSPEND) {
                logger.debug("Suspending response: {}", response);
                suspend(action, request, response);
            }
            else if (action.type == Action.TYPE.RESUME) {
                logger.debug("Resuming response: {}", response);

                if (supportSession()) {
                    AsyncContext asyncContext =
                            (AsyncContext) request.getSession().getAttribute("org.atmosphere.container.asyncContext");

                    if (asyncContext != null) {
                        asyncContext.complete();
                    }
                }

                Action nextAction = resumed(request, response);
                if (nextAction.type == Action.TYPE.SUSPEND) {
                    logger.debug("Suspending after resuming response: {}", response);
                    suspend(action, request, response);
                }
            }
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) {
                logger.debug("Suspending 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) {
            HttpEvent event = (HttpEvent) req.getAttribute(HTTP_EVENT);
            if (event == null) {
                return action;
            }
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.