java讀取請求中body資料
/** * 獲取request中body資料 * * @author lifq * * 2017年2月24日 下午2:29:06 * @throws IOException */ public static String getRequestBodyData(HttpServletRequest request) throws IOException{ BufferedReader bufferReader = new BufferedReader(request.getReader()); StringBuilder sb = new StringBuilder(); String line = null; while ((line = bufferReader.readLine()) != null) { sb.append(line); } return sb.toString(); }