code: private static String getRequestBody(HttpServletRequest request) {
          String body = null;
          try (BufferedReader requestReader = request.getReader()) {
              StringBuffer bodyLines = new StringBuffer();
              String bodyLine;
              while ((bodyLine = requestReader.readLine()) != null) {
                  bodyLines.append(bodyLine);
              }
              body = bodyLines.toString();
          } catch (IOException e) {
              LOG.info("Failed to obtain a Reader for a potential body of"
                  + " this POST, assuming KVP");
          }
  
          return body;
      }
docs: Extract Request body as String of {@link HttpServletRequest}
  
  @param request {@link HttpServletRequest} to extract body from
  @return