private String getRequestBody ( ServletRequest request ) throws IOException { final StringBuilder sb = new StringBuilder ( ) ; String line = request . getReader ( ) . readLine ( ) ; while ( null != line ) { sb . append ( line ) ; line = request . getReader ( ) . readLine ( ) ; } return sb . toString ( ) ; }
Returns the body of the request . This method is used to read posted JSON data .