List of usage examples for javax.servlet ServletRequest getParameterValues
public String[] getParameterValues(String name);
String
objects containing all of the values the given request parameter has, or null
if the parameter does not exist. From source file:indi.edrik.utils.ServletUtils.java
/** * ???Request Parameters.//w w w .java 2s . co m * * Parameter???. */ @SuppressWarnings("rawtypes") public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Assert.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while (paramNames != null && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if (values == null || values.length == 0) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.ejushang.steward.common.util.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * /* w w w . j a v a2 s . co m*/ * Parameter???. */ public static Map<String, String[]> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, String[]> params = new TreeMap<String, String[]>(); if (prefix == null) { prefix = ""; } while (paramNames != null && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if (values == null || values.length == 0) { params.put(unprefixed, new String[0]); } else { params.put(unprefixed, values); } } } return params; }
From source file:cn.ligoo.part.util.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * /*from w w w . j a v a 2 s .c om*/ * Parameter???. */ @SuppressWarnings("rawtypes") public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0)) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.agileEAP.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * /*w w w . j a v a2 s . com*/ * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while (paramNames != null && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if (values == null || values.length == 0) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.i5le.framwork.core.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from w w w . j a v a 2 s .c o m * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0) || values[0].equals("")) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.yxw.framework.mvc.controller.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * // w ww.j a va 2 s. c om * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0)) { // Do nothing, no values found at all. logger.error("(values == null) || (values.length == 0"); } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.ourpalm.editor.util.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from w ww .j av a 2 s. c o m * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration<String> paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0)) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:com.weaforce.system.util.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from w ww . ja va 2s. co m * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration<?> paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while (paramNames != null && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if (values == null || values.length == 0) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:cc.sion.core.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * * Parameter???.//w w w . ja v a 2 s . c o m */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0)) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:net.cloudkit.enterprises.infrastructure.utilities.ServletHelper.java
/** * ???Request Parameters, copy from spring WebUtils. * <p/>//from w w w . j a v a 2 s .com * Parameter???. */ public static Map<String, Object> getParametersStartingWith(ServletRequest request, String prefix) { Validate.notNull(request, "Request must not be null"); Enumeration<?> paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); if (prefix == null) { prefix = ""; } while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); if ("".equals(prefix) || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if ((values == null) || (values.length == 0)) { // Do nothing, no values found at all. } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }