示例#1
0
  private URL getLogHostURL(String loggedBySID) {
    SessionID sid = new SessionID(loggedBySID);

    String sessionProtocol = sid.getSessionServerProtocol();
    String sessionHost = sid.getSessionServer();
    String sessionPort = sid.getSessionServerPort();
    String sessionURI = sid.getSessionServerURI();

    //
    //  if remote logging service and protocol, host, and port
    //  are null, get them from the logging service url in the
    //  AMConfig.properties file.
    //
    if ((!manager.isLocal)
        && ((sessionProtocol == null)
            || (sessionProtocol.length() <= 0)
            || (sessionHost == null)
            || (sessionHost.length() <= 0))) {
      if (Debug.messageEnabled()) {
        Debug.message("RemoteHandler.getLogHostURL(): remote serv = " + logServURL);
      }
      return (logServURL);
    }

    if (Debug.messageEnabled()) {
      Debug.message(
          "RemoteHandler.getLogHostURL(): "
              + " sessionProtocol: "
              + sessionProtocol
              + " sessionHost: "
              + sessionHost
              + " sessionPort: "
              + sessionPort
              + " sessionURI: "
              + sessionURI);
    }
    URL loggingURL = null;
    try {
      loggingURL =
          WebtopNaming.getServiceURL(
              LogConstants.LOGGING_SERVICE, sessionProtocol, sessionHost, sessionPort, sessionURI);

      if (Debug.messageEnabled()) {
        Debug.message(
            "RemoteHandler.getLogHostURL(): WebtopNaming logging" + "service URL: " + loggingURL);
      }
    } catch (URLNotFoundException unfe) {
      Debug.error("RemoteHandler.getLogHostURL(): URLNotFoundException: ", unfe);
      return null;
    }
    return loggingURL;
  }
 /**
  * Returns Session Service URL.
  *
  * @param protocol Session Server protocol.
  * @param server Session Server host name.
  * @param port Session Server port.
  * @param uri Session Server URI.
  * @return URL Session Service URL.
  * @exception com.iplanet.dpro.session.SessionException
  */
 public URL getSessionServiceURL(String protocol, String server, String port, String uri)
     throws SessionException {
   String key = protocol + "://" + server + ":" + port + uri;
   URL url = sessionServiceURLTable.get(key);
   if (url == null) {
     try {
       url = WebtopNaming.getServiceURL(SESSION_SERVICE, protocol, server, port, uri);
       sessionServiceURLTable.put(key, url);
       return url;
     } catch (Exception e) {
       throw new SessionException(e);
     }
   }
   return url;
 }