public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException {
try {
final String action = pReq.getParameter("action");
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.");