有用代码笔记()

用inputStream读取json请求参数
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;ServletInputStream inputStream = httpServletRequest.getInputStream();byte[] byteArr = new byte[1024];ByteArrayOutputStream out = new ByteArrayOutputStream();int length;while ((length = inputStream.read(byteArr)) != -1) {    out.write(byteArr, 0, length);}String requestBody = new String(out.toByteArray(), "UTF-8");
————————
用inputStream读取json请求参数
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;ServletInputStream inputStream = httpServletRequest.getInputStream();byte[] byteArr = new byte[1024];ByteArrayOutputStream out = new ByteArrayOutputStream();int length;while ((length = inputStream.read(byteArr)) != -1) {    out.write(byteArr, 0, length);}String requestBody = new String(out.toByteArray(), "UTF-8");