code: public static void processHeaders(Map<String, List<String>> headers, HttpServletResponse res) {
  
          if (headers != null) {
              Iterator<Map.Entry<String, List<String>>> i = headers.entrySet().iterator();
              while (i.hasNext()) {
                  Map.Entry<String, List<String>> entry = i.next();
                  String key = entry.getKey();
                  List<String> l = entry.getValue();
                  for (int j = 0; j < l.size(); j++) {
                      if ((j == 0) && ((l.get(0)).startsWith(SET_HEADER))) {
                          String s = l.get(0);
                          res.setHeader(key, s.substring(SET_HEADER.length()));
                      } else {
                          res.addHeader(key, l.get(j));
                      }
                  }
              }
          }
      }
docs: Process the headers stored in the provided map and add them to the response.<p>
  
  @param headers the headers to add
  @param res the response to add the headers to