List of usage examples for javax.servlet.http HttpServletRequest getParameterMap
public Map<String, String[]> getParameterMap();
From source file:com.google.step2.Step2.java
/** * Returns a ParameterList (list of openid-related query parameters) from * an HttpServletRequest.//from ww w . j av a2 s.co m * @param req the HttpServletRequest * @return a ParameterList */ public static ParameterList getParameterList(HttpServletRequest req) { return new ParameterList(req.getParameterMap()); }
From source file:com.amar.web.demo.utils.ServletUtil.java
@SuppressWarnings("rawtypes") public static <T> T request2Bean(HttpServletRequest request, Class<T> beanClass) { try {//ww w. ja va 2 s . c o m T bean = beanClass.newInstance(); Map map = request.getParameterMap(); BeanUtils.populate(bean, map); return bean; } catch (Exception e) { throw new RuntimeException(e); } }
From source file:edu.unc.lib.dl.ui.util.FileIOUtil.java
public static String postImport(HttpServletRequest request, String url) { Map<String, String[]> parameters = request.getParameterMap(); HttpClientParams params = new HttpClientParams(); params.setContentCharset("UTF-8"); HttpClient client = new HttpClient(); client.setParams(params);/*from w w w .j av a2 s . c o m*/ PostMethod post = new PostMethod(url); Iterator<Entry<String, String[]>> parameterIt = parameters.entrySet().iterator(); while (parameterIt.hasNext()) { Entry<String, String[]> parameter = parameterIt.next(); for (String parameterValue : parameter.getValue()) { post.addParameter(parameter.getKey(), parameterValue); } } try { client.executeMethod(post); return post.getResponseBodyAsString(); } catch (Exception e) { throw new ResourceNotFoundException("Failed to retrieve POST import request for " + url, e); } finally { post.releaseConnection(); } }
From source file:com.hbc.api.gateway.alizhifu.util.AlipayCallBackValidator.java
public static Map<String, String> getParameterMap(HttpServletRequest request) { Set<String> keyset = request.getParameterMap().keySet(); Map<String, String> result = new HashMap<String, String>(); for (String key : keyset) { String[] values = request.getParameterValues(key); for (int i = 0; i < values.length; i++) { String value = values[i]; result.put(key, value);//ww w. j a v a 2s .c o m } } return result; }
From source file:com.tang.util.RequestBeanKit.java
/**** * contentType application/x-www-form-urlencoded * ??//from w w w . ja v a 2s.co m * * @param request * @return */ public static JSONObject buildJSONFromParm(HttpServletRequest request) { Map<String, String[]> parmMap = request.getParameterMap(); //json JSONObject parmObject = new JSONObject(); String objectKey = ""; for (Map.Entry<String, String[]> entry : parmMap.entrySet()) { String key = entry.getKey(); String value = entry.getValue()[0]; if (key.contains("[")) { objectKey = key.substring(0, key.indexOf("[")); JSONObject targetObject = new JSONObject(); if (parmObject.containsKey(objectKey)) { targetObject = parmObject.getJSONObject(objectKey); } String targetObjectKey = key.substring(key.indexOf("[") + 1, key.indexOf("]")); targetObject.put(targetObjectKey, value); parmObject.put(objectKey, targetObject); } else { parmObject.put(key, value); } } return parmObject; }
From source file:de.thorstenberger.taskmodel.view.AJAXSaveStudentAnnotationAction.java
public static void logPostData(HttpServletRequest request, Tasklet tasklet) { Map vars = request.getParameterMap(); StringBuffer parameters = new StringBuffer(); Iterator keys = vars.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); parameters.append(key + "=" + ((String[]) vars.get(key))[0] + "\n"); }/*from ww w . j a va 2 s .com*/ tasklet.logPostData("StudentAnnotation: posted parameters:\n" + parameters.toString(), request.getRemoteAddr()); }
From source file:eu.morfeoproject.fast.catalogue.util.Util.java
@SuppressWarnings("unchecked") public static Map<String, String[]> getParams(HttpServletRequest request) { Map<String, String[]> params = request.getParameterMap(); return params; }
From source file:de.micromata.genome.logging.LogRequestParameterAttribute.java
/** * Fuer Logging gibt alle requestparameter in einer Zeile aus. * * @param request the request// ww w. j av a 2 s . c om * @param excludingKeys the excluding keys * @return the request for logging */ public static String getRequestForLogging(HttpServletRequest request, String... excludingKeys) { if (request == null || request.getParameterMap().isEmpty() == true) { return "<no params>"; } StringBuilder sb = new StringBuilder(); for (Enumeration<?> en = request.getParameterNames(); en.hasMoreElements() == true;) { String s = (String) en.nextElement(); String[] values = request.getParameterValues(s); for (String v : values) { for (String exKey : excludingKeys) { if (StringUtils.equals(s, exKey) == true) { v = "****"; break; } } // for sb.append(s).append("=").append(v).append("\n"); } } return sb.toString(); }
From source file:edu.stanford.muse.webapp.NewFilter.java
/** in future, could create Filter from a list of detailed facet items to make it more robust // currently, we create a filter from the given request */ public static NewFilter createFilterFromRequest(HttpServletRequest request) { NewFilter f = new NewFilter(); // copy over the request params into the filter's map for (Object p : request.getParameterMap().keySet()) f.map.put((String) p, request.getParameterValues((String) p)); return f;/*from www .j a v a 2s. co m*/ }
From source file:com.gst.infrastructure.security.data.PlatformRequestLog.java
public static PlatformRequestLog from(final StopWatch task, final HttpServletRequest request) throws IOException { final String requestUrl = request.getRequestURL().toString(); final Map<String, String[]> parameters = new HashMap<>(request.getParameterMap()); parameters.remove("password"); parameters.remove("_"); return new PlatformRequestLog(task.getStartTime(), task.getTime(), request.getMethod(), requestUrl, parameters);//from w ww.j a va 2 s. c o m }