private void perform(final HttpRequest request, final HttpResponse response, boolean hasBody) {
final String path = request.getRequestedPath();
final File file = new File(path.substring(1)); // remove the leading '/'
if (!file.exists()) {
throw new HttpException(404);
} else if (!file.isFile()) {
throw new HttpException(403, path + "is not a file");
}
final long lastModified = file.lastModified();
response.setHeader("Last-Modified", String.valueOf(lastModified));
response.setHeader("Cache-Control", "public");