Java Code Examples for javax.portlet.ActionRequest#getParameterValues()

The following examples show how to use javax.portlet.ActionRequest#getParameterValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: URLTests_ActionURL.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@ActionMethod(portletName = "ActionURLTests")
public void processAction(ActionRequest portletReq,
      ActionResponse portletResp) throws PortletException, IOException {

   // evaluate results for test case
   // V3URLTests_ActionURL_setParameterB7
   {
      ModuleTestCaseDetails tcd = new ModuleTestCaseDetails();
      TestResult tr8 = tcd.getTestResultFailed(
          V3URLTESTS_ACTIONURL_SETPARAMETERB7);
      String tcval = portletReq.getParameter("tc");
      // let exception be thrown if tc parm isn't defined (test case error)
      if (tcval != null && tcval != null && tcval
          .equals("V3URLTests_ActionURL_setParameterB7")) {
         String[] aval = portletReq.getParameterValues("parm1");
         String[] eval = null;
         CompareUtils.arraysEqual("Request", aval, " expected: ", eval, tr8);
         PortletSession ps = portletReq.getPortletSession();
         ps.setAttribute(
             RESULT_ATTR_PREFIX
             + "V3URLTests_ActionURL_setParameterB7",
             tr8);
         portletResp.setRenderParameter("tc", tcval);
      }
   }
}
 
Example 2
Source File: PortletUtils.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Pass all the action request parameters to the render phase by putting them into
 * the action response object. This may not be called when the action will call
 * {@link javax.portlet.ActionResponse#sendRedirect sendRedirect}.
 * @param request the current action request
 * @param response the current action response
 * @see javax.portlet.ActionResponse#setRenderParameter
 */
public static void passAllParametersToRenderPhase(ActionRequest request, ActionResponse response) {
	try {
		Enumeration<String> en = request.getParameterNames();
		while (en.hasMoreElements()) {
			String param = en.nextElement();
			String values[] = request.getParameterValues(param);
			response.setRenderParameter(param, values);
		}
	}
	catch (IllegalStateException ex) {
		// Ignore in case sendRedirect was already set.
	}
}