code: protected void addCacheControlHeaders(final HttpServletResponse servletResponse,
                                                   final FedoraResource resource,
                                                   final HttpSession session) {
  
          if (session.isBatchSession()) {
              // Do not add caching headers if in a transaction
              return;
          }
  
          final EntityTag etag;
          final Instant date;
  
          // See note about this code in the javadoc above.
          if (resource instanceof FedoraBinary) {
              // Use a strong ETag for LDP-NR
              etag = new EntityTag(resource.getEtagValue());
              date = resource.getLastModifiedDate();
          } else {
              // Use a weak ETag for the LDP-RS
              etag = new EntityTag(resource.getEtagValue(), true);
              date = resource.getLastModifiedDate();
          }
  
          if (!etag.getValue().isEmpty()) {
              servletResponse.addHeader("ETag", etag.toString());
  
              //State Tokens, while not used for caching per se,  nevertheless belong
              //here since we can conveniently reuse the value of the etag for
              //our state token
              servletResponse.addHeader("X-State-Token", etag.getValue());
          }
  
          if (date != null) {
              servletResponse.addDateHeader("Last-Modified", date.toEpochMilli());
          }
      }
docs: Add ETag and Last-Modified cache control headers to the response
  <p>
  Note: In this implementation, the HTTP headers for ETags and Last-Modified dates are swapped
  for fedora:Binary resources and their descriptions. Here, we are drawing a distinction between
  the HTTP resource and the LDP resource. As an HTTP resource, the last-modified header should
  reflect when the resource at the given URL was last changed. With fedora:Binary resources and
  their descriptions, this is a little complicated, for the descriptions have, as their subjects,
  the binary itself. And the fedora:lastModified property produced by that NonRdfSourceDescription
  refers to the last-modified date of the binary -- not the last-modified date of the
  NonRdfSourceDescription.
  </p>
  @param servletResponse the servlet response
  @param resource the fedora resource
  @param session the session