예제 #1
0
 /*
  * (non-Javadoc)
  * @see org.atmosphere.gwt.server.AtmosphereGwtHandler#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.List,
  * org.atmosphere.gwt.server.GwtAtmosphereResource)
  */
 @Override
 public void doPost(
     HttpServletRequest postRequest,
     HttpServletResponse postResponse,
     List<?> messages,
     GwtAtmosphereResource cometResource) {
   for (final Object s : messages) {
     eventProcessing.processMessage(s, cometResource.getAtmosphereResource());
   }
 }
예제 #2
0
  /*
   * (non-Javadoc)
   * @see org.atmosphere.gwt.server.AtmosphereGwtHandler#doComet(org.atmosphere.gwt.server.GwtAtmosphereResource)
   */
  @Override
  public int doComet(GwtAtmosphereResource resource) throws ServletException, IOException {
    HttpSession session = resource.getAtmosphereResource().getRequest().getSession();
    if (session.getAttribute(BROADCASTERSESSIONKEY) == null)
      session.setAttribute(BROADCASTERSESSIONKEY, BroadcasterFactory.getDefault().get());
    resource
        .getAtmosphereResource()
        .setBroadcaster((Broadcaster) session.getAttribute(BROADCASTERSESSIONKEY));
    Broadcaster b = BroadcasterFactory.getDefault().lookup(GLOBALBROADCASTERID);
    if (b == null) {
      b = BroadcasterFactory.getDefault().get(GLOBALBROADCASTERID);
    }
    b.addAtmosphereResource(resource.getAtmosphereResource());

    if (logger.isDebugEnabled()) {
      logger.debug(
          "Url: "
              + resource.getAtmosphereResource().getRequest().getRequestURL()
              + "?"
              + resource.getAtmosphereResource().getRequest().getQueryString());
    }
    return NO_TIMEOUT;
  }