code: public static Map createHeadersMap(PageContext pContext)
      {
          final HttpServletRequest request =
                  (HttpServletRequest) pContext.getRequest();
  
          return new EnumeratedMap()
          {
              public Enumeration enumerateKeys()
              {
                  return request.getHeaderNames();
              }
  
              public Object getValue(Object pKey)
              {
                  if (pKey instanceof String) {
                      // Drain the header enumeration
                      List l = new ArrayList();
                      Enumeration enum_ = request.getHeaders((String) pKey);
                      if (enum_ != null) {
                          while (enum_.hasMoreElements()) {
                              l.add(enum_.nextElement());
                          }
                      }
                      String[] ret = (String[]) l.toArray(new String[l.size()]);
                      return ret;
                  } else {
                      return null;
                  }
              }
  
              public boolean isMutable()
              {
                  return false;
              }
          };
      }
docs: Creates the Map that maps header name to an array of header
  values.