List of usage examples for org.springframework.http HttpHeaders IF_UNMODIFIED_SINCE
String IF_UNMODIFIED_SINCE
To view the source code for org.springframework.http HttpHeaders IF_UNMODIFIED_SINCE.
Click Source Link
From source file:com.github.zhanhb.ckfinder.download.PathPartial.java
/** * Check if the if-unmodified-since condition is satisfied. * * @param request The servlet request we are processing * @param attr File attributes// www. ja v a 2 s . c o m */ private void checkIfUnmodifiedSince(HttpServletRequest request, BasicFileAttributes attr) { if (request.getHeader(HttpHeaders.IF_MATCH) == null) { try { long lastModified = attr.lastModifiedTime().toMillis(); long headerValue = request.getDateHeader(HttpHeaders.IF_UNMODIFIED_SINCE); if (headerValue != -1 && lastModified >= headerValue + 1000) { // The entity has not been modified since the date // specified by the client. This is not an error case. throw new UncheckException(HttpServletResponse.SC_PRECONDITION_FAILED); } } catch (IllegalArgumentException ex) { throw new UncheckException(HttpServletResponse.SC_PRECONDITION_FAILED); } } }