code: public static String getHeaders(HttpServletRequest request) {
          String headerString = "";
          Enumeration<String> headerNames = request.getHeaderNames();
  
          while (headerNames.hasMoreElements()) {
              String name = headerNames.nextElement();
              if (name.equals(Constants.ODO_PROXY_HEADER)) {
                  // skip.. don't want to log this
                  continue;
              }
  
              if (headerString.length() != 0) {
                  headerString += "\n";
              }
  
              headerString += name + ": " + request.getHeader(name);
          }
  
          return headerString;
      }
docs: Obtain newline-delimited headers from request
  
  @param request HttpServletRequest to scan
  @return newline-delimited headers