从HttpServletRequest中获取body中的参数

阅读更多
Map params = new HashMap();
		BufferedReader br;
		try {
			br = request.getReader();
			String str, wholeStr = "";
			while((str = br.readLine()) != null){
				wholeStr += str;
			}
			if(StringUtils.isNotEmpty(wholeStr)){
				params = JSON.parseObject(wholeStr,Map.class);
			}
		} catch (IOException e1) {
			logger.error(""+e1);
		}

你可能感兴趣的:(从HttpServletRequest中获取body中的参数)