List of usage examples for com.liferay.portal.kernel.struts LastPath getPath
public String getPath()
From source file:se.vgregion.userassociations.hook.UserCommunityAction.java
License:Open Source License
/** * The action is run by Liferay when the user log in. * Uses configured matchers that associate the user with community/organization, * and redirect the user to its community. * * @param request the HttpRequest/* w w w . j a v a2 s .c o m*/ * @param response the HttpResponse is not used, needed for the method signature. * @throws ActionException wrap all exceptions in an ActionException. */ @Override public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException { LOGGER.info("user login action"); try { HttpSession session = request.getSession(); User user = null; user = getUserLocalService().getUser(getPortal().getUserId(request)); resolveAssociations(user); LastPath lastPath = (LastPath) session.getAttribute(WebKeys.LAST_PATH); LOGGER.info("before: " + (lastPath == null ? "null" : lastPath.getPath())); if (lastPath == null || lastPath.getPath() == null || lastPaths.contains(lastPath.getPath())) { // Look for Communities - No path form initial call lastPath = computeLastPath(request.getContextPath(), user); } LOGGER.info("after: " + (lastPath == null ? "null" : lastPath.getPath())); if (lastPath != null) { session.setAttribute(WebKeys.LAST_PATH, lastPath); } } catch (SystemException e) { throw new ActionException(e); } catch (PortalException e) { throw new ActionException(e); } }