1 package org.exoplatform.services.portletcontainer.test.portlet; 2 3 import org.exoplatform.services.portletcontainer.impl.portletAPIImp.PortletURLImp; 4 5 import javax.portlet.*; 6 import java.io.IOException ; 7 import java.io.PrintWriter ; 8 9 13 14 21 public class PortletToTestPortletURL implements Portlet{ 22 public void init(PortletConfig portletConfig) throws PortletException { 23 } 25 26 public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { 27 } 28 29 public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { 30 31 renderResponse.setContentType("text/html"); 33 PortletURL pURL = renderResponse.createRenderURL(); 34 pURL.setParameter("test", "aTest"); 35 String param = (String ) ((PortletURLImp)pURL).getParameter("test"); 36 if(!"aTest".equals(param)) 37 throw new PortletException("setParameter does not work"); 38 39 pURL.setParameter("test2", "aTest2"); 40 param = (String ) ((PortletURLImp)pURL).getParameter("test2"); 41 if(!"aTest2".equals(param)) 42 throw new PortletException("setParameter does not work"); 43 44 PrintWriter w = renderResponse.getWriter(); 45 w.println("Everything is ok"); 46 } 47 48 public void destroy() { 49 } 51 } 52 | Popular Tags |