1 package org.exoplatform.services.portletcontainer.test.portlet; 2 3 import javax.portlet.*; 4 import java.io.IOException ; 5 import java.io.PrintWriter ; 6 import java.util.Map ; 7 8 12 13 20 public class PortletToTestGetParameterXXXMethods extends GenericPortlet{ 21 22 public void init(PortletConfig portletConfig) throws PortletException { 23 } 24 25 public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) 26 throws PortletException, IOException { 27 Map map = actionRequest.getParameterMap(); 28 29 String param = actionRequest.getParameter("dummy"); 30 if(param != null) 31 throw new PortletException("getParameter does not work"); 32 actionRequest.getParameter("dummy"); 33 actionRequest.getParameter("dummy"); 34 35 if(!map.isEmpty()) 36 throw new PortletException("getParameter does not work"); 37 38 actionResponse.setRenderParameter("status", "Everything is ok"); 39 } 40 41 public void render(RenderRequest renderRequest, RenderResponse renderResponse) 42 throws PortletException, IOException { 43 renderResponse.setContentType("text/html"); 45 String param1 = renderRequest.getParameter("renderParam1"); 46 String [] param1Array = renderRequest.getParameterValues("renderParam1"); 47 String [] param2Array = renderRequest.getParameterValues("renderParam2"); 48 49 if(!"param-value1bis".equals(param1Array[1])) 50 throw new PortletException("getParameter does not work"); 51 52 if(!param1.equals(param1Array[0])) 53 throw new PortletException("getParameter does not work"); 54 55 if(param2Array.length != 1 || !"param-value2".equals(param2Array[0])) 56 throw new PortletException("getParameter does not work"); 57 58 try { 59 renderRequest.getParameterMap().put("s","unmutable"); 60 throw new PortletException("getParameter does not work"); 61 } catch (Throwable t) { 62 } 63 64 PrintWriter w = renderResponse.getWriter(); 65 w.println("Everything is ok"); 66 } 67 68 public void destroy() { 69 } 71 72 } 73 | Popular Tags |