Package org.atmosphere.cpr

Examples of org.atmosphere.cpr.Meteor.suspend()


    public ActionForward openCometChannel(ActionMapping mapping, ActionForm _form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        logger.info("BEGIN SimpleAction.openCometChannel()");
        Meteor m = Meteor.build(req, list, null);
        m.setBroadcaster(b);
        req.getSession().setAttribute("meteor", m);
        m.suspend(-1);
        m.broadcast(req.getServerName()
                + "__has suspended a connection from " + req.getRemoteAddr());
        return null;
    }
View Full Code Here


    public static class Meteor1 extends HttpServlet {
        @Override
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
            final Meteor m = Meteor.build(req);
            req.getSession().setAttribute("meteor", m);
            m.suspend(5000, false);
           
            m.broadcast("resume");
            m.addListener(new AtmosphereResourceEventListener(){

                @Override
View Full Code Here

        public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
            final Meteor m = Meteor.build(req);
            m.getBroadcaster().setScope(Broadcaster.SCOPE.REQUEST);
            req.getSession().setAttribute("meteor", m);
           
            m.suspend(5000, false);
            broadcasterId.set(m.getBroadcaster().getID());

            res.getOutputStream().write("resume".getBytes());
            m.addListener(new AtmosphereResourceEventListener(){
View Full Code Here

        req.getSession().setAttribute("meteor", m);

        res.setContentType("text/html;charset=ISO-8859-1");

        m.suspend(-1);
        m.broadcast(req.getServerName() + "__has suspended a connection from " + req.getRemoteAddr());
    }

    /**
     * Re-use the {@link Meteor} created onthe first GET for broadcasting message.
View Full Code Here

        // Depending on the connection
        String transport = req.getHeader("X-Atmosphere-Transport");

        // Suspend the connection. Could be long-polling, streaming or websocket.
        meteor.suspend(-1, !(transport != null && transport.equalsIgnoreCase("long-polling")));
    }

    public void onBroadcast(AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
        logger.info("onBroadcast(): {}", event.getMessage());
View Full Code Here

    String transport = request.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
    if (HeaderConfig.LONG_POLLING_TRANSPORT.equalsIgnoreCase(transport))
    {
      // request.getContainerRequest().setAttribute(ApplicationConfig.RESUME_ON_BROADCAST,
      // Boolean.TRUE);
      meteor.suspend(-1, false);
    }
    else
    {
      meteor.suspend(-1);
    }
View Full Code Here

      // Boolean.TRUE);
      meteor.suspend(-1, false);
    }
    else
    {
      meteor.suspend(-1);
    }
  }

  @Override
  public void onBroadcast(AtmosphereResourceEvent event)
View Full Code Here

    String transport = request.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
    if (HeaderConfig.LONG_POLLING_TRANSPORT.equalsIgnoreCase(transport))
    {
      // request.getContainerRequest().setAttribute(ApplicationConfig.RESUME_ON_BROADCAST,
      // Boolean.TRUE);
      meteor.suspend(-1, false);
    }
    else
    {
      meteor.suspend(-1);
    }
View Full Code Here

      // Boolean.TRUE);
      meteor.suspend(-1, false);
    }
    else
    {
      meteor.suspend(-1);
    }
  }

  @Override
  public void onBroadcast(AtmosphereResourceEvent event)
View Full Code Here

    // Grab a Meteor
    Meteor meteor = Meteor.build(request.getContainerRequest());
    // Add us to the listener list.
    meteor.addListener(this);
    meteor.suspend(-1);

    String uuid = meteor.getAtmosphereResource().uuid();
    Page page = getComponent().getPage();
    page.setMetaData(ATMOSPHERE_UUID, uuid);
    findEventBus().registerPage(uuid, page);
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.