code: public static void writeIfModified(HttpAcceptSession httpSession, File requestFile) throws IOException {
          if (requestFile.isFile() && requestFile.exists()) {
              String etag = getETagHeaderValue(requestFile);
              String ifNoneMatch = httpSession.getReadHeader("If-None-Match");
              String ifModifiedSince = httpSession.getReadHeader("If-Modified-Since");
              if (!hasBeenModified(requestFile, etag, ifNoneMatch, ifModifiedSince)) {
                  httpSession.setWriteHeader("ETag", etag);
                  httpSession.setStatus(REDIRECT_NOT_MODIFIED);
              }
              else {
                  FileInputStream in = new FileInputStream(requestFile);
  
                  byte[] buf = new byte[8192];
                  IoBufferAllocatorEx<?> allocator = httpSession.getBufferAllocator();
                  IoBufferEx out = allocator.wrap(allocator.allocate(in.available())).setAutoExpander(allocator);
                  int length;
                  while ((length = in.read(buf)) > 0) {
                      out.put(buf, 0, length);
                  }
                  out.flip();
                  in.close();
                  httpSession.setWriteHeader("ETag", etag);
                  httpSession.setWriteHeader("Last-Modified", RFC822_FORMAT_PATTERN.format(requestFile.lastModified()));
                  httpSession.setWriteHeader("Expires", RFC822_FORMAT_PATTERN.format(System.currentTimeMillis()));
                  httpSession.suspendWrite();
                  httpSession.write(out);
                  httpSession.shutdownWrite();
                  httpSession.resumeWrite();
  
                  // Note: callers are responsible for adding the Content-Type header,
                  // per KG-866.  See HttpCrossSiteBridgeFilter for an example.
              }
          }
          else {
              httpSession.setStatus(CLIENT_NOT_FOUND);
          }
      }
docs: ported from httpFileRequested (above)