获取httpSelevtRequest所有参数


@RequestMapping(value = "/callback", produces = "application/json;charset=utf-8")
public Map callBack(HttpServletRequest request) {
    Map result = new HashMap<>();
    Map resultParam = request.getParameterMap();
    Set keSet = resultParam.entrySet();
    for (Iterator itr = keSet.iterator(); itr.hasNext(); ) {
        Map.Entry me = (Map.Entry) itr.next();
        Object ok = me.getKey();
        Object ov = me.getValue();
        String[] value = new String[1];
        if (ov instanceof String[]) {
            value = (String[]) ov;
        } else {
            value[0] = ov.toString();
        }

        for (int k = 0; k < value.length; k++) {
            logger.info(ok + "=" + value[k]);
            result.put(ok.toString(), value[k]);
        }
    }
    return result;
}

 

你可能感兴趣的:(开发问题总览)