001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.action;
016    
017    import com.liferay.portal.kernel.util.ParamUtil;
018    import com.liferay.portal.util.PortalUtil;
019    import com.liferay.portal.util.SessionClicks;
020    
021    import java.util.Enumeration;
022    
023    import javax.servlet.http.HttpServletRequest;
024    import javax.servlet.http.HttpServletResponse;
025    
026    import org.apache.struts.action.Action;
027    import org.apache.struts.action.ActionForm;
028    import org.apache.struts.action.ActionForward;
029    import org.apache.struts.action.ActionMapping;
030    
031    /**
032     * @author Brian Wing Shun Chan
033     */
034    public class SessionClickAction extends Action {
035    
036            public ActionForward execute(
037                            ActionMapping mapping, ActionForm form, HttpServletRequest request,
038                            HttpServletResponse response)
039                    throws Exception {
040    
041                    try {
042                            Enumeration<String> enu = request.getParameterNames();
043    
044                            while (enu.hasMoreElements()) {
045                                    String name = enu.nextElement();
046    
047                                    if (!name.equals("doAsUserId")) {
048                                            String value = ParamUtil.getString(request, name);
049    
050                                            SessionClicks.put(request, name, value);
051                                    }
052                            }
053    
054                            return null;
055                    }
056                    catch (Exception e) {
057                            PortalUtil.sendError(e, request, response);
058    
059                            return null;
060                    }
061            }
062    
063    }