1 7 8 package org.exoplatform.services.portletcontainer.test.portlet; 9 10 import java.io.IOException ; 11 import java.io.PrintWriter ; 12 13 import javax.portlet.ActionRequest; 14 import javax.portlet.ActionResponse; 15 import javax.portlet.GenericPortlet; 16 import javax.portlet.PortletException; 17 import javax.portlet.PortletMode; 18 import javax.portlet.PortletURL; 19 import javax.portlet.RenderRequest; 20 import javax.portlet.RenderResponse; 21 import javax.portlet.WindowState; 22 23 27 public class PortletToTestMarkupWithRewrittenURL extends GenericPortlet{ 28 29 protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) 30 throws PortletException, IOException { 31 PortletURL pURL = renderResponse.createRenderURL(); 32 renderResponse.setContentType("text/html"); 33 PrintWriter w = renderResponse.getWriter(); 34 if(renderRequest.getWindowState() == WindowState.NORMAL){ 35 pURL.setPortletMode(PortletMode.EDIT); 36 pURL.setWindowState(WindowState.MAXIMIZED); 37 pURL.setSecure(false); 38 pURL.setParameter("param", "value"); 39 pURL.setParameter("param2", "value2"); 40 41 w.print("From PortletURL : " + pURL.toString()); 42 } else { 43 w.print(renderRequest.getParameter("param")); 44 } 45 } 46 47 protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse) 48 throws PortletException, IOException { 49 PortletURL pURL = renderResponse.createRenderURL(); 50 pURL.setPortletMode(PortletMode.EDIT); 51 pURL.setWindowState(WindowState.MAXIMIZED); 52 pURL.setSecure(false); 53 pURL.setParameter("param", "value"); 54 pURL.setParameter("param2", "value2"); 55 56 renderResponse.setContentType("text/html"); 57 PrintWriter w = renderResponse.getWriter(); 58 59 w.print("From PortletURL : " + pURL.toString()); 60 } 61 62 public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) 63 throws PortletException, IOException { 64 } 65 66 } 67 | Popular Tags |