private void ifUnmodifiedSince(DavRequest request, DavResponse response, DavResource resource) throws DavException, IOException { if (resource == null) return; long mod = resource.getModificationTime(); if (mod == -1) return; mod = mod / 1000 * 1000; long since = request.getDateHeader("If-Unmodified-Since"); if (since == -1) return; if (mod <= since) return; throw new PreconditionFailedException("If-Unmodified-Since disallows conditional request"); }
private void ifModifiedSince(DavRequest request, DavResponse response, DavResource resource) throws DavException, IOException { if (resource == null) return; long mod = resource.getModificationTime(); if (mod == -1) return; mod = mod / 1000 * 1000; long since = request.getDateHeader("If-Modified-Since"); if (since == -1) return; if (mod > since) return; throw new NotModifiedException(); }