001
014
015 package com.liferay.portlet.myaccount.action;
016
017 import com.liferay.portal.kernel.servlet.DynamicServletRequest;
018 import com.liferay.portal.model.User;
019 import com.liferay.portal.struts.PortletAction;
020 import com.liferay.portal.util.PortalUtil;
021 import com.liferay.portlet.RenderRequestImpl;
022
023 import javax.portlet.PortletConfig;
024 import javax.portlet.RenderRequest;
025 import javax.portlet.RenderResponse;
026 import javax.portlet.WindowState;
027
028 import org.apache.struts.action.ActionForm;
029 import org.apache.struts.action.ActionForward;
030 import org.apache.struts.action.ActionMapping;
031
032
036 public class ViewAction extends PortletAction {
037
038 @Override
039 public ActionForward render(
040 ActionMapping actionMapping, ActionForm actionForm,
041 PortletConfig portletConfig, RenderRequest renderRequest,
042 RenderResponse renderResponse)
043 throws Exception {
044
045 if (renderRequest.getRemoteUser() == null) {
046 return actionMapping.findForward("portlet.my_account.view");
047 }
048
049 if (!renderRequest.getWindowState().equals(WindowState.MAXIMIZED)) {
050 return actionMapping.findForward("portlet.my_account.view");
051 }
052
053 User user = PortalUtil.getUser(renderRequest);
054
055 RenderRequestImpl renderRequestImpl = (RenderRequestImpl)renderRequest;
056
057 DynamicServletRequest dynamicRequest =
058 (DynamicServletRequest)renderRequestImpl.getHttpServletRequest();
059
060 dynamicRequest.setParameter(
061 "p_u_i_d", String.valueOf(user.getUserId()));
062
063 return actionMapping.findForward("portlet.my_account.edit_user");
064 }
065
066 }