对接渠道经常会用到,将request转成map集合
以前网上找了个很长,这次渠道自带的方法很舒服,就更新了
@RequestMapping(value = "/deliver", method = { RequestMethod.POST, RequestMethod.GET })
public void deliver(HttpServletRequest request, HttpServletResponse response) throws IOException {
LOGGER.error("deliver request ip:{},queryString: {},parameter:{}", ServletUtils.getRemoteAddress(request), request.getQueryString(),
request.getParameterMap());
String result = "FAILURE";
try {
Map<String, Object> params = getParameterMap(request);
result = xingfeiService.doDeliver(params);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
response.getWriter().write(result);
}
/**
* 将请求参数转化为Map
*
* @param request
* @return
*/
public static Map<String, Object> getParameterMap(HttpServletRequest request) {
Map<String, Object&