policy = LaunchSessionManager.getLaunchRequestPolicy(request, session, resource);
} catch (Exception expt) {
ActionMessages errs = new ActionMessages();
errs.add(Globals.ERROR_KEY, new BundleActionMessage("policyframework", "resourceNotAttachedToPolicy"));
saveErrors(request, errs);
return new RedirectWithMessages(returnTo, request);
}
Util.noCache(response);
if(resource.sessionPasswordRequired(session)) {
// Prompt for the session password then come back here
return new ActionForward("/promptForSessionPassword.do?forwardTo=" + Util.urlEncode(CoreUtil.getRealRequestURI(request) + "?resourceId=" + id + "&policy=" + policy.getResourceId() + "&returnTo=" + Util.urlEncode(returnTo)), true);
}
else {
// Launch the agent and return here
if(isAgentRequired(resource) && !DefaultAgentManager.getInstance().hasActiveAgent(request)) {
return new ActionForward("/launchAgent.do?returnTo=" + Util.urlEncode(CoreUtil.getRealRequestURI(request) + "?resourceId=" + id + "&policy=" + policy.getResourceId() + "&returnTo=" + Util.urlEncode(returnTo)), true);
}
else {
LaunchSession launchSession = LaunchSessionFactory.getInstance().createLaunchSession(session, resource, policy);
launchSession.checkAccessRights(null, session);
try {
return launch(mapping, launchSession, request, returnTo);
}
catch(CoreException ce) {
ActionMessages errs = new ActionMessages();
errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
saveErrors(request, errs);
return new RedirectWithMessages(returnTo, request);
}
}
}
}