org.devefx.validator.util.ServletUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of validator-web Show documentation
Show all versions of validator-web Show documentation
Jave Web Validator Framework
package org.devefx.validator.util;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
public class ServletUtils {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void extractUrlParams(MultiValueMap multiValueMap, HttpServletRequest request) {
Map parameterMap = request.getParameterMap();
for (Map.Entry entry: parameterMap.entrySet()) {
String key = entry.getKey();
String[] values = entry.getValue();
for (String value : values) {
multiValueMap.add(key, value);
}
}
}
@SuppressWarnings("rawtypes")
public static MultiValueMap extractUrlParams(HttpServletRequest request) {
MultiValueMap valueMap = new LinkedMultiValueMap<>();
extractUrlParams(valueMap, request);
return valueMap;
}
}