CompositeContext moduleContext = CurrentCompositeContext.getContext();
AccountService accountServices = (AccountService) moduleContext.locateService(AccountService.class, "AccountServiceComponent");
if (accountServices == null) {
throw new ServletException("AccountServiceComponent");
}
ProfileService profileServices = null;
if (!"createAccount".equals(action)) {
profileServices = moduleContext.locateService(ProfileService.class, "ProfileServiceComponent");
if (profileServices == null) {
throw new ServletException("ProfileServiceComponent not found.");
}
if (!profileServices.isLoggedIn()) {
throw new ServletException("User id '" + profileServices.getId() + "' not logged on.");
}
}
if ("createAccount".equals(action)) {
createAccount(pReq, pResp, accountServices);