天天看点

servlet 获取 body Json数据(post 请求)

servlet 获取 body Json数据(post 请求)

postman测试请求接口:

后台代码 :

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		try{
			InputStream is= null;
			is = request.getInputStream();
			String bodyInfo = IOUtils.toString(is, "utf-8");
			LOG.info("入参信息:"+bodyInfo);
           

 org.apache.commons.io.IOUtils;