示例#1
0
  /**
   * This method forwards the serverSession on the ServerPortal. This means that all ServerSession
   * events will arrive on this portal's EventQueueHandler.
   *
   * @param portal - the portal to which the serverSession will be forwarded
   * @param serverSession - sesrverSession that will be forwarded
   */
  public void forward(ServerPortal portal, ServerSession serverSession) {
    if (LOG.isDebugEnabled()) {
      LOG.debug(this.toLogString() + "portal " + portal + " ses id is " + serverSession.getId());
    }
    if (portal == this) { // in case forward was called but the user really means accept
      accept(serverSession);
      return;
    }
    URI uriForForward = portal.getUri();
    if (uriForForward.getHost().equals("0.0.0.0")) {
      uriForForward = this.replaceIPinURI(uriForForward, serverSession.getUri());
    }

    serverSession.setEventQueueHandlers(this.eqh, portal.eqh);
    if (!Bridge.forwardSession(uriForForward.toString(), serverSession.getId(), portal.getId()))
      LOG.error("forward failed");
    portal.setSession(serverSession);
  }
示例#2
0
 /**
  * This method accepts the serverSession on this ServerPortal. This means that all ServerSession
  * events will arrive on this ServerPortal's EventQueueHandler.
  *
  * @param serverSession - serverSession that will be accepted
  */
 public void accept(ServerSession serverSession) {
   serverSession.setEventQueueHandlers(this.eqh, this.eqh);
   if (!Bridge.acceptSession(serverSession.getId(), this.getId())) LOG.error("accept failed");
   this.setSession(serverSession);
 }