code: private static Map<String, String> getHeadersAsHashMap(HttpServletRequest request) {
        Map<String, String> headers = new HashMap<String, String>();
        
        for (Enumeration<?> h=request.getHeaderNames(); h.hasMoreElements();) {
           String headerName = (String) h.nextElement();
           String headerValue = request.getHeader(headerName);
           headers.put(headerName.toLowerCase(), headerValue);
        }
        
        return headers;
        
     }
docs: convenience method turn http headers into a hash map
  
  @param request
  @return