docs: @SuppressWarnings("resource") // Clears warning about RandomAccessFile not
        // being closed. It is closed in operationComplete().
    public void sendFile(final HttpResponseStatus status,
                         final String path,
                         final int max_age) throws IOException {
      if (max_age < 0) {
        throw new IllegalArgumentException("Negative max_age=" + max_age
                                           + " for path=" + path);
      }
      if (!channel().isConnected()) {
        done();
        return;
      }
      RandomAccessFile file;
      try {
        file = new RandomAccessFile(path, "r");
      } catch (FileNotFoundException e) {
        logWarn("File not found: " + e.getMessage());
        if (getQueryString() != null && !getQueryString().isEmpty()) {
          getQueryString().remove("png");  // Avoid potential recursion.
        }
        this.sendReply(HttpResponseStatus.NOT_FOUND, serializer.formatNotFoundV1());
        return;
      }
      final long length = file.length();
      {
        final String mimetype = guessMimeTypeFromUri(path);
        response().headers().set(HttpHeaders.Names.CONTENT_TYPE,
                           mimetype == null ? "text/plain" : mimetype);
        final long mtime = new File(path).lastModified();
        if (mtime > 0) {
          response().headers().set(HttpHeaders.Names.AGE,
                             (System.currentTimeMillis() - mtime) / 1000);
        } else {
          logWarn("Found a file with mtime=" + mtime + ": " + path);
        }
        response().headers().set(HttpHeaders.Names.CACHE_CONTROL,
                           "max-age=" + max_age);
        HttpHeaders.setContentLength(response(), length);
        channel().write(response());
      }
      final DefaultFileRegion region = new DefaultFileRegion(file.getChannel(),
                                                             0, length);
      final ChannelFuture future = channel().write(region);
      future.addListener(new ChannelFutureListener() {
        public void operationComplete(final ChannelFuture future) {
          region.releaseExternalResources();
          done();
        }
      });
      if (!HttpHeaders.isKeepAlive(request())) {
        future.addListener(ChannelFutureListener.CLOSE);
      }
    }