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 javax.servlet.http.HttpServletRequest;
030 import javax.servlet.http.HttpServletResponse;
031 import javax.servlet.http.HttpSession;
032
033
036 public class DefaultLandingPageAction extends Action {
037
038 @Override
039 public void run(HttpServletRequest request, HttpServletResponse response)
040 throws ActionException {
041
042 try {
043 doRun(request, response);
044 }
045 catch (Exception e) {
046 throw new ActionException(e);
047 }
048 }
049
050 protected void doRun(
051 HttpServletRequest request, HttpServletResponse response)
052 throws Exception {
053
054 long companyId = PortalUtil.getCompanyId(request);
055
056 String path = PrefsPropsUtil.getString(
057 companyId, PropsKeys.DEFAULT_LANDING_PAGE_PATH);
058
059 if (_log.isInfoEnabled()) {
060 _log.info(
061 PropsKeys.DEFAULT_LANDING_PAGE_PATH + StringPool.EQUAL + path);
062 }
063
064 if (Validator.isNotNull(path)) {
065 LastPath lastPath = new LastPath(StringPool.BLANK, path);
066
067 HttpSession session = request.getSession();
068
069 session.setAttribute(WebKeys.LAST_PATH, lastPath);
070 }
071
072
073
074
075
076
077
084 }
085
086 private static Log _log = LogFactoryUtil.getLog(
087 DefaultLandingPageAction.class);
088
089 }