前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。
方法如下:
try{ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();HttpServletRequest request = requestAttributes.getRequest();StringBuffer sb = new StringBuffer() ;InputStream is = request.getInputStream();InputStreamReader isr = new InputStreamReader(is);BufferedReader br = new BufferedReader(isr);String s = "" ;while((s=br.readLine())!=null){sb.append(s) ;}String result =sb.toString();log.info("\n\n ----------- 请求 json 为 :"+result);}catch (Exception e){... }