001
014
015 package com.liferay.portal.events;
016
017 import com.liferay.portal.kernel.events.Action;
018 import com.liferay.portal.kernel.events.ActionException;
019 import com.liferay.portal.kernel.log.Log;
020 import com.liferay.portal.kernel.log.LogFactoryUtil;
021 import com.liferay.portal.kernel.struts.LastPath;
022 import com.liferay.portal.kernel.util.PropsKeys;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.kernel.util.Validator;
025 import com.liferay.portal.util.PortalUtil;
026 import com.liferay.portal.util.PrefsPropsUtil;
027 import com.liferay.portal.util.WebKeys;
028
029 import java.util.HashMap;
030
031 import javax.servlet.http.HttpServletRequest;
032 import javax.servlet.http.HttpServletResponse;
033 import javax.servlet.http.HttpSession;
034
035
038 public class DefaultLandingPageAction extends Action {
039
040 public void run(HttpServletRequest request, HttpServletResponse response)
041 throws ActionException {
042
043 try {
044 doRun(request, response);
045 }
046 catch (Exception e) {
047 throw new ActionException(e);
048 }
049 }
050
051 protected void doRun(
052 HttpServletRequest request, HttpServletResponse response)
053 throws Exception {
054
055 long companyId = PortalUtil.getCompanyId(request);
056
057 String path = PrefsPropsUtil.getString(
058 companyId, PropsKeys.DEFAULT_LANDING_PAGE_PATH);
059
060 if (_log.isInfoEnabled()) {
061 _log.info(
062 PropsKeys.DEFAULT_LANDING_PAGE_PATH + StringPool.EQUAL + path);
063 }
064
065 if (Validator.isNotNull(path)) {
066 LastPath lastPath = new LastPath(
067 StringPool.BLANK, path, new HashMap<String, String[]>());
068
069 HttpSession session = request.getSession();
070
071 session.setAttribute(WebKeys.LAST_PATH, lastPath);
072 }
073
074
075
076
077
078
079
086 }
087
088 private static Log _log = LogFactoryUtil.getLog(
089 DefaultLandingPageAction.class);
090
091 }