code: public static String getHeaders(final HttpServletRequest req) {
      Enumeration en = req.getHeaderNames();
      StringBuffer sb = new StringBuffer();
  
      while (en.hasMoreElements()) {
        String name = (String) en.nextElement();
        sb.append(name);
        sb.append(": ");
        sb.append(req.getHeader(name));
        sb.append("\n");
      }
      return sb.toString();
    }
docs: Return a concatenated string of all the headers
  
  @param   req    Incoming HttpServletRequest object
  @return  header values