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.action;
16  
17  import com.liferay.portal.kernel.util.ParamUtil;
18  import com.liferay.portal.util.PortalUtil;
19  import com.liferay.portal.util.SessionClicks;
20  
21  import java.util.Enumeration;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.apache.struts.action.Action;
27  import org.apache.struts.action.ActionForm;
28  import org.apache.struts.action.ActionForward;
29  import org.apache.struts.action.ActionMapping;
30  
31  /**
32   * <a href="SessionClickAction.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   */
36  public class SessionClickAction extends Action {
37  
38      public ActionForward execute(
39              ActionMapping mapping, ActionForm form, HttpServletRequest request,
40              HttpServletResponse response)
41          throws Exception {
42  
43          try {
44              Enumeration<String> enu = request.getParameterNames();
45  
46              while (enu.hasMoreElements()) {
47                  String name = enu.nextElement();
48  
49                  if (!name.equals("doAsUserId")) {
50                      String value = ParamUtil.getString(request, name);
51  
52                      SessionClicks.put(request, name, value);
53                  }
54              }
55  
56              return null;
57          }
58          catch (Exception e) {
59              PortalUtil.sendError(e, request, response);
60  
61              return null;
62          }
63      }
64  
65  }