code: public static Map<String, Object> createRequestAttributesMap(HttpServletRequest request) {
          Map<String, Object> attributesMap = new HashMap<>();
          for (Enumeration attributeNameEnum = request.getAttributeNames(); attributeNameEnum.hasMoreElements(); ) {
              String attributeName = (String)attributeNameEnum.nextElement();
  
              attributesMap.put(attributeName, request.getAttribute(attributeName));
          }
  
          return attributesMap;
      }
docs: Creates a map from the request attributes in the specified request.
  
  @param request the request