-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.jsp
80 lines (61 loc) · 2.68 KB
/
index.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<%--
/**
* Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ page import="com.liferay.portal.events.ServicePreAction" %>
<%@ page import="com.liferay.portal.kernel.servlet.HttpHeaders" %>
<%@ page import="com.liferay.portal.kernel.util.InstancePool" %>
<%@ page import="com.liferay.portal.model.Layout" %>
<%@ page import="com.liferay.portal.model.LayoutConstants" %>
<%@ page import="com.liferay.portal.model.LayoutSet" %>
<%@ page import="com.liferay.portal.service.LayoutLocalServiceUtil" %>
<%@ page import="com.liferay.portal.theme.ThemeDisplay" %>
<%@ page import="com.liferay.portal.util.PortalUtil" %>
<%@ page import="com.liferay.portal.util.WebKeys" %>
<%
// According to http://www.webmasterworld.com/forum91/3087.htm a semicolon in
// the URL for a meta-refresh tag does not work in IE 6.
// To work around this issue, we use a URL without a session id for meta-refresh
// and rely on the load event on the body element to properly rewrite the URL.
String redirect = null;
LayoutSet layoutSet = (LayoutSet)request.getAttribute(WebKeys.VIRTUAL_HOST_LAYOUT_SET);
if (layoutSet != null) {
long defaultPlid = LayoutLocalServiceUtil.getDefaultPlid(layoutSet.getGroupId(), layoutSet.isPrivateLayout());
if (defaultPlid != LayoutConstants.DEFAULT_PLID) {
Layout layout = LayoutLocalServiceUtil.getLayout(defaultPlid);
ServicePreAction servicePreAction = (ServicePreAction)InstancePool.get(ServicePreAction.class.getName());
ThemeDisplay themeDisplay = servicePreAction.initThemeDisplay(request, response);
redirect = PortalUtil.getLayoutURL(layout, themeDisplay);
}
else {
redirect = PortalUtil.getPathMain();
}
}
else {
redirect = PortalUtil.getHomeURL(request);
}
if (!request.isRequestedSessionIdFromCookie()) {
redirect = PortalUtil.getURLWithSessionId(redirect, session.getId());
}
response.setHeader(HttpHeaders.LOCATION, redirect);
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
%>
<html>
<head>
<title></title>
<meta content="1; url=<%= redirect %>" http-equiv="refresh" />
</head>
<body onload="javascript:location.replace('<%= redirect %>')">
</body>
</html>