All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.devefx.validator.util.ServletUtils Maven / Gradle / Ivy

There is a newer version: 1.0.2-release
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy