1
19
20 package com.liferay.portal.events;
21
22 import com.liferay.portal.kernel.events.Action;
23 import com.liferay.portal.kernel.events.ActionException;
24 import com.liferay.portal.kernel.log.Log;
25 import com.liferay.portal.kernel.log.LogFactoryUtil;
26 import com.liferay.portal.kernel.util.StringPool;
27 import com.liferay.portal.kernel.util.Validator;
28 import com.liferay.portal.struts.LastPath;
29 import com.liferay.portal.util.PortalUtil;
30 import com.liferay.portal.util.PrefsPropsUtil;
31 import com.liferay.portal.util.PropsKeys;
32 import com.liferay.portal.util.WebKeys;
33
34 import java.util.HashMap;
35
36 import javax.servlet.http.HttpServletRequest;
37 import javax.servlet.http.HttpServletResponse;
38 import javax.servlet.http.HttpSession;
39
40
46 public class DefaultLandingPageAction extends Action {
47
48 public void run(HttpServletRequest request, HttpServletResponse response)
49 throws ActionException {
50
51 try {
52 doRun(request, response);
53 }
54 catch (Exception e) {
55 throw new ActionException(e);
56 }
57 }
58
59 protected void doRun(
60 HttpServletRequest request, HttpServletResponse response)
61 throws Exception {
62
63 long companyId = PortalUtil.getCompanyId(request);
64
65 String path = PrefsPropsUtil.getString(
66 companyId, PropsKeys.DEFAULT_LANDING_PAGE_PATH);
67
68 if (_log.isInfoEnabled()) {
69 _log.info(
70 PropsKeys.DEFAULT_LANDING_PAGE_PATH + StringPool.EQUAL + path);
71 }
72
73 if (Validator.isNotNull(path)) {
74 LastPath lastPath = new LastPath(
75 StringPool.BLANK, path, new HashMap<String, String[]>());
76
77 HttpSession session = request.getSession();
78
79 session.setAttribute(WebKeys.LAST_PATH, lastPath);
80 }
81
82
87
94 }
95
96 private static Log _log =
97 LogFactoryUtil.getLog(DefaultLandingPageAction.class);
98
99 }