code: private void setHeader(HttpServletResponse response, String name, String value) {
          if(response.containsHeader(value)) {
                response.setHeader(name, value);
          } else {
              response.addHeader(name, value);
          }
      }
docs: Set Cache header.
  
  @param response The HttpResponse to set header on
  @param name     Name of the header to set
  @param value    Value of the header to set.