1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.events;
16  
17  import com.liferay.portal.kernel.events.Action;
18  import com.liferay.portal.util.WebKeys;
19  
20  import java.util.Map;
21  
22  import javax.servlet.http.HttpServletRequest;
23  import javax.servlet.http.HttpServletResponse;
24  import javax.servlet.http.HttpSession;
25  
26  /**
27   * <a href="ClearRenderParametersAction.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class ClearRenderParametersAction extends Action {
32  
33      public void run(HttpServletRequest request, HttpServletResponse response) {
34  
35          // Some users are confused by the behavior stated in the JSR 168 spec
36          // that render parameters are saved across requests. Set this class to
37          // always clear render parameters to please those users. You can also
38          // modify the "layout.remember.request.window.state.maximized" property
39          // in portal.properties to disable the remembering of window states
40          // across requests.
41  
42          HttpSession session = request.getSession();
43  
44          Map<Long, Map<String, Map<String, String[]>>> renderParametersPool =
45              (Map<Long, Map<String, Map<String, String[]>>>)session.getAttribute(
46                  WebKeys.PORTLET_RENDER_PARAMETERS);
47  
48          if (renderParametersPool != null) {
49              renderParametersPool.clear();
50          }
51      }
52  
53  }