}
});
}
private void checkLastModified(RC request, long lastModified, Runnable runner) throws IOException {
ServletRequestContext servletRequest = getServletRequestContext(request);
// ���磺
// 1. requestΪservlet request��
// ���ң�lastModified >= 0��
// ���ң�GET������
// 2. ���ߣ�lastModified > ifModifiedSince
// ִ��runner
if (lastModified < 0 || servletRequest == null
|| !"get".equalsIgnoreCase(servletRequest.getRequest().getMethod())) {
runner.run();
} else {
long ifModifiedSince = servletRequest.getRequest().getDateHeader("If-Modified-Since");
if (ifModifiedSince < lastModified / 1000 * 1000) {
if (lastModified >= 0) {
servletRequest.getResponse().setDateHeader("Last-Modified", lastModified);
}
runner.run();
} else {
servletRequest.getResponse().setStatus(SC_NOT_MODIFIED);
}
}
}