通过HttpServletRequest 获取接口返回的json数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dc282614966/article/details/89962662

1.获取方式

Map<String, String> map = WitMedicalUtils.parseRequestMap(request.getParameterMap());

2.解析方法:WitMedicalUtils.parseRequestMap()

public static Map<String,String> parseRequestMap( Map<String, String[]> map){
        logger.info("#########Map:"+JSON.toJSONString(map));
        Map<String, String> params = new HashMap<String,String>();
        int len;
        for (Map.Entry<String, String[]> entry : map.entrySet()) {
            len = entry.getValue().length;
            if (len == 1) {
                params.put(entry.getKey(), entry.getValue()[0]);
            } else if (len > 1) {
                params.put(entry.getKey(), String.valueOf(entry.getValue()));
            }
        }
        return params;
    }

 

展开阅读全文

没有更多推荐了,返回首页