1 package org.exoplatform.services.portletcontainer.test.portlet; 2 3 import javax.portlet.*; 4 import java.io.IOException ; 5 import java.io.PrintWriter ; 6 7 11 12 19 public class PortletToTestIncomingRequestParam extends GenericPortlet{ 20 21 public void init(PortletConfig portletConfig) throws PortletException { 22 } 23 24 public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) 25 throws PortletException, IOException { 26 String param1 = actionRequest.getParameter("param1"); 27 String param2 = actionRequest.getParameter("param2"); 28 String param3 = actionRequest.getParameter("param3"); 29 30 if(!"param-value1".equals(param1)) 31 throw new PortletException("getParameter does not work"); 32 if(!"param-value2".equals(param2)) 33 throw new PortletException("getParameter does not work"); 34 if(!"param-value3".equals(param3)) 35 throw new PortletException("getParameter does not work"); 36 37 actionResponse.setRenderParameter("status", "Everything is ok"); 38 } 39 40 public void render(RenderRequest renderRequest, RenderResponse renderResponse) 41 throws PortletException, IOException { 42 renderResponse.setContentType("text/html"); 44 String param1 = renderRequest.getParameter("renderParam1"); 45 String param2 = renderRequest.getParameter("renderParam2"); 46 String param3 = renderRequest.getParameter("renderParam3"); 47 48 if(!"param-value1".equals(param1)) 49 throw new PortletException("getParameter does not work"); 50 if(!"param-value2".equals(param2)) 51 throw new PortletException("getParameter does not work"); 52 if(!"param-value3".equals(param3)) 53 throw new PortletException("getParameter does not work"); 54 55 PrintWriter w = renderResponse.getWriter(); 56 w.println("Everything is ok"); 57 } 58 59 public void destroy() { 60 } 62 63 } 64 | Popular Tags |