code: private String getRequestContent(HttpServletRequest request) throws IOException {
          StringBuilder builder = new StringBuilder();
          
          builder.append(request.getProtocol());
          builder.append(" ");
          builder.append(request.getMethod());
          builder.append(" ");
          builder.append(request.getRequestURI());
          builder.append(NEWLINE);
          
          Enumeration<?> headerNames = request.getHeaderNames();
          while (headerNames.hasMoreElements()) {
              String headerName = headerNames.nextElement().toString();
              
              builder.append(headerName);
              builder.append(":");
              
              Enumeration<?> headerValues = request.getHeaders(headerName);
              if (headerValues.hasMoreElements()) {
                  builder.append(headerValues.nextElement());
              }
              
              while (headerValues.hasMoreElements()) {
                  builder.append(",");
                  builder.append(headerValues.nextElement());
              }
              
              builder.append(NEWLINE);
          }
          
          builder.append(NEWLINE);
          builder.append(FileUtils.readToString(request.getInputStream()));
          
          return builder.toString();
      }
docs: Builds raw request message content from Http servlet request.
  @param request
  @return
  @throws IOException