List of usage examples for javax.servlet ServletRequest getParameterNames
public Enumeration<String> getParameterNames();
Enumeration
of String
objects containing the names of the parameters contained in this request. From source file:com.androidwhy.modules.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from w w w . 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 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()); unprefixed = unprefixed.replace("__", "."); 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. * /* w w w . j a va 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 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)) { // 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.agileEAP.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from ww w . java 2 s .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:com.ourpalm.editor.util.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * //from w w w. j a va 2s .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 .j a v a 2s. 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:cc.sion.core.web.Servlets.java
/** * ???Request Parameters, copy from spring WebUtils. * * Parameter???./* ww w .jav a2 s.co 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 ww w.j av a 2 s . 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:com.github.dactiv.common.utils.ServletUtils.java
/** * ???Request Parameters./*www . j a va 2 s. c o m*/ * * Parameter???. */ 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) { } else if (values.length > 1) { params.put(unprefixed, values); } else { params.put(unprefixed, values[0]); } } } return params; }
From source file:net.turnbig.pandora.web.Servlets.java
/** * ?Request Parameters, copy from spring WebUtils. * //from ww w . j av a 2s .c o m * Parameter */ @SuppressWarnings("rawtypes") public static Map<String, Object> getParameters(ServletRequest request) { Enumeration paramNames = request.getParameterNames(); Map<String, Object> params = new TreeMap<String, Object>(); while ((paramNames != null) && paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); 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(paramName, values); } else { params.put(paramName, values[0]); } } return params; }