| ServicePostAction.java |
1 /**
2 * Copyright (c) 2000-2009 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 */
19
20 package com.liferay.portal.events;
21
22 import com.liferay.portal.kernel.events.Action;
23 import com.liferay.portal.kernel.log.Log;
24 import com.liferay.portal.kernel.log.LogFactoryUtil;
25 import com.liferay.portal.security.permission.PermissionChecker;
26 import com.liferay.portal.security.permission.PermissionCheckerFactory;
27 import com.liferay.portal.security.permission.PermissionThreadLocal;
28 import com.liferay.portal.theme.ThemeDisplay;
29 import com.liferay.portal.theme.ThemeDisplayFactory;
30 import com.liferay.portal.util.WebKeys;
31
32 import javax.servlet.http.HttpServletRequest;
33 import javax.servlet.http.HttpServletResponse;
34
35 /**
36 * <a href="ServicePostAction.java.html"><b><i>View Source</i></b></a>
37 *
38 * @author Brian Wing Shun Chan
39 *
40 */
41 public class ServicePostAction extends Action {
42
43 public void run(HttpServletRequest request, HttpServletResponse response) {
44 try {
45
46 // Make sure this is called only once per full request, ignore
47 // requests spawned by the portlet
48
49 //String requestURI = GetterUtil.getString(request.getRequestURI());
50
51 // Doesn't this cause a memory leak?
52
53 /*if (requestURI.endsWith("/portal/render_portlet")) {
54 return;
55 }*/
56 }
57 catch (Exception e) {
58 _log.error(e);
59 }
60
61 try {
62
63 // Clean up the theme display
64
65 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
66 WebKeys.THEME_DISPLAY);
67
68 ThemeDisplayFactory.recycle(themeDisplay);
69 }
70 catch (Exception e) {
71 _log.error(e);
72 }
73
74 request.removeAttribute(WebKeys.THEME_DISPLAY);
75
76 try {
77
78 // Clean up the permission checker
79
80 PermissionChecker permissionChecker =
81 PermissionThreadLocal.getPermissionChecker();
82
83 PermissionCheckerFactory.recycle(permissionChecker);
84 }
85 catch (Exception e) {
86 _log.error(e);
87 }
88 }
89
90 private static Log _log = LogFactoryUtil.getLog(ServicePostAction.class);
91
92 }