/** * Returns the request parameter value as a String array. In the returned * array, each parameter value not convertible to a String is replaced by * the default value. * * @param request the servlet request from which to read the parameter * @param param the name of the parameter * @param defaultValue a default value * @param split whether to split the single parameter value using comma * separators to get multiple values * @return the request parameter value as a String array */ public static String[] getParameterValues( HttpServletRequest request, String param, String[] defaultValue, boolean split) { String[] values = request.getParameterValues(param); if (values == null) { return _normalize(defaultValue); } if (split && (values.length == 1)) { return _normalize(StringUtil.split(values[0])); } return _normalize(values); }
/** * Returns the request parameter value as a String. If the parameter is * missing or not convertible to a String, a blank string is returned. * * @param request the servlet request from which to read the parameter * @param param the name of the parameter * @return the request parameter value as a String */ public static String getString(HttpServletRequest request, String param) { return _normalize(GetterUtil.getString(request.getParameter(param))); }
/** * Returns the request parameter value as a String. If the parameter is * missing or not convertible to a String, the default value is returned. * * @param request the servlet request from which to read the parameter * @param param the name of the parameter * @param defaultValue a default value * @return the request parameter value as a String */ public static String get( HttpServletRequest request, String param, String defaultValue) { String returnValue = GetterUtil.get( request.getParameter(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }
/** * Returns the service context parameter value as a String. If the parameter * is missing or not convertible to a String, a blank string is returned. * * @param serviceContext the service context from which to read the * parameter * @param param the name of the parameter * @return the service context parameter value as a String */ public static String getString( ServiceContext serviceContext, String param) { return _normalize( GetterUtil.getString(serviceContext.getAttribute(param))); }
/** * Returns the portlet request parameter value as a String. If the parameter * is missing or not convertible to a String, a blank string is returned. * * @param portletRequest the portlet request from which to read the * parameter * @param param the name of the parameter * @return the portlet request parameter value as a String */ public static String getString( PortletRequest portletRequest, String param) { return _normalize( GetterUtil.getString(portletRequest.getParameter(param))); }
/** * Returns the request parameter value as a String array. In the returned * array, each parameter value not convertible to a String is replaced by * the default value. * * @param request the servlet request from which to read the parameter * @param param the name of the parameter * @param defaultValue a default value * @return the request parameter value as a String array */ public static String[] getStringValues( HttpServletRequest request, String param, String[] defaultValue) { return GetterUtil.getStringValues( getParameterValues(request, param, null), () -> _normalize(defaultValue)); }
/** * Returns the service context parameter value as a String array. In the * returned array, each parameter value not convertible to a String is * replaced by the default value. * * @param serviceContext the service context from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the service context parameter value as a String array */ public static String[] getStringValues( ServiceContext serviceContext, String param, String[] defaultValue) { return GetterUtil.getStringValues( serviceContext.getAttribute(param), () -> _normalize(defaultValue)); }
/** * Returns the portlet request parameter value as a String array. In the * returned array, each parameter value not convertible to a String is * replaced by the default value. * * @param portletRequest the portlet request from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the portlet request parameter value as a String array */ public static String[] getStringValues( PortletRequest portletRequest, String param, String[] defaultValue) { return GetterUtil.getStringValues( getParameterValues(portletRequest, param, null), () -> _normalize(defaultValue)); }
/** * Returns the service context parameter value as a String. If the parameter * is missing or not convertible to a String, the default value is returned. * * @param serviceContext the service context from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the service context parameter value as a String */ public static String get( ServiceContext serviceContext, String param, String defaultValue) { String returnValue = GetterUtil.get( serviceContext.getAttribute(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }
/** * Returns the portlet request parameter value as a String. If the parameter * is missing or not convertible to a String, the default value is returned. * * @param portletRequest the portlet request from which to read the * parameter * @param param the name of the parameter * @param defaultValue a default value * @return the portlet request parameter value as a String */ public static String get( PortletRequest portletRequest, String param, String defaultValue) { String returnValue = GetterUtil.get( portletRequest.getParameter(param), defaultValue); if (returnValue != null) { return _normalize(StringUtil.trim(returnValue)); } return null; }