Search in sources :

Example 1 with URLNotFoundException

use of com.iplanet.services.naming.URLNotFoundException in project OpenAM by OpenRock.

the class RemoteHandler method getLogHostURL.

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 ((!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;
}
Also used : URLNotFoundException(com.iplanet.services.naming.URLNotFoundException) SessionID(com.iplanet.dpro.session.SessionID) URL(java.net.URL)

Example 2 with URLNotFoundException

use of com.iplanet.services.naming.URLNotFoundException in project OpenAM by OpenRock.

the class ResourceResultCache method getPolicyServiceURL.

/**
    * Returns policy service URL based on session token
    * @param token session token of user
    * @return policy service URL based on session token
    * @throws PolicyException if can not get policy service URL
    */
static URL getPolicyServiceURL(SSOToken token) throws PolicyException {
    URL policyServiceURL = null;
    try {
        String ssoTokenID = token.getTokenID().toString();
        SessionID sid = new SessionID(ssoTokenID);
        Session session = sessionCache.getSession(sid);
        URL sessionServiceURL = session.getSessionServiceURL();
        String protocol = sessionServiceURL.getProtocol();
        String host = sessionServiceURL.getHost();
        int port = sessionServiceURL.getPort();
        String uri = sessionServiceURL.getPath();
        String portString = null;
        if (port == -1) {
            portString = "";
        } else {
            portString = Integer.toString(port);
        }
        policyServiceURL = WebtopNaming.getServiceURL(POLICY_SERVICE_ID_FOR_NAMING, protocol, host, portString, uri);
    } catch (SessionException se) {
        debug.error("ResourceResultCache.getPolicyServiceURL():" + "Can not find policy service URL", se);
        throw new PolicyEvaluationException(ResBundleUtils.rbName, "policy_service_url_not_found", null, se);
    } catch (URLNotFoundException ue) {
        debug.error("ResourceResultCache.getPolicyServiceURL():" + "Can not find policy service URL", ue);
        throw new PolicyEvaluationException(ResBundleUtils.rbName, "policy_service_url_not_found", null, ue);
    }
    return policyServiceURL;
}
Also used : SessionException(com.iplanet.dpro.session.SessionException) PolicyEvaluationException(com.sun.identity.policy.remote.PolicyEvaluationException) URLNotFoundException(com.iplanet.services.naming.URLNotFoundException) SessionID(com.iplanet.dpro.session.SessionID) URL(java.net.URL) Session(com.iplanet.dpro.session.Session)

Aggregations

SessionID (com.iplanet.dpro.session.SessionID)2 URLNotFoundException (com.iplanet.services.naming.URLNotFoundException)2 URL (java.net.URL)2 Session (com.iplanet.dpro.session.Session)1 SessionException (com.iplanet.dpro.session.SessionException)1 PolicyEvaluationException (com.sun.identity.policy.remote.PolicyEvaluationException)1