| ServicePostAction.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * The contents of this file are subject to the terms of the Liferay Enterprise
5 * Subscription License ("License"). You may not use this file except in
6 * compliance with the License. You can obtain a copy of the License by
7 * contacting Liferay, Inc. See the License for the specific language governing
8 * permissions and limitations under the License, including but not limited to
9 * distribution rights of the Software.
10 *
11 *
12 *
13 */
14
15 package com.liferay.portal.events;
16
17 import com.liferay.portal.kernel.events.Action;
18 import com.liferay.portal.kernel.log.Log;
19 import com.liferay.portal.kernel.log.LogFactoryUtil;
20 import com.liferay.portal.security.permission.PermissionChecker;
21 import com.liferay.portal.security.permission.PermissionCheckerFactory;
22 import com.liferay.portal.security.permission.PermissionThreadLocal;
23 import com.liferay.portal.theme.ThemeDisplay;
24 import com.liferay.portal.theme.ThemeDisplayFactory;
25 import com.liferay.portal.util.WebKeys;
26
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpServletResponse;
29
30 /**
31 * <a href="ServicePostAction.java.html"><b><i>View Source</i></b></a>
32 *
33 * @author Brian Wing Shun Chan
34 */
35 public class ServicePostAction extends Action {
36
37 public void run(HttpServletRequest request, HttpServletResponse response) {
38 try {
39
40 // Make sure this is called only once per full request, ignore
41 // requests spawned by the portlet
42
43 //String requestURI = GetterUtil.getString(request.getRequestURI());
44
45 // Doesn't this cause a memory leak?
46
47 /*if (requestURI.endsWith("/portal/render_portlet")) {
48 return;
49 }*/
50 }
51 catch (Exception e) {
52 _log.error(e);
53 }
54
55 try {
56
57 // Clean up the theme display
58
59 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
60 WebKeys.THEME_DISPLAY);
61
62 ThemeDisplayFactory.recycle(themeDisplay);
63 }
64 catch (Exception e) {
65 _log.error(e);
66 }
67
68 request.removeAttribute(WebKeys.THEME_DISPLAY);
69
70 try {
71
72 // Clean up the permission checker
73
74 PermissionChecker permissionChecker =
75 PermissionThreadLocal.getPermissionChecker();
76
77 PermissionCheckerFactory.recycle(permissionChecker);
78 }
79 catch (Exception e) {
80 _log.error(e);
81 }
82 }
83
84 private static Log _log = LogFactoryUtil.getLog(ServicePostAction.class);
85
86 }