001
014
015 package com.liferay.portlet.myaccount.action;
016
017 import com.liferay.portal.model.User;
018 import com.liferay.portal.struts.PortletAction;
019 import com.liferay.portal.util.PortalUtil;
020 import com.liferay.portlet.RenderRequestImpl;
021 import com.liferay.util.servlet.DynamicServletRequest;
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 public ActionForward render(
039 ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
040 RenderRequest renderRequest, RenderResponse renderResponse)
041 throws Exception {
042
043 if (renderRequest.getRemoteUser() == null) {
044 return mapping.findForward("portlet.my_account.view");
045 }
046
047 if (!renderRequest.getWindowState().equals(WindowState.MAXIMIZED)) {
048 return mapping.findForward("portlet.my_account.view");
049 }
050
051 User user = PortalUtil.getUser(renderRequest);
052
053 RenderRequestImpl renderRequestImpl = (RenderRequestImpl)renderRequest;
054
055 DynamicServletRequest dynamicRequest =
056 (DynamicServletRequest)renderRequestImpl.getHttpServletRequest();
057
058 dynamicRequest.setParameter(
059 "p_u_i_d", String.valueOf(user.getUserId()));
060
061 return mapping.findForward("portlet.my_account.edit_user");
062 }
063
064 }