Exemplo n.º 1
0
  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");
  }
Exemplo n.º 2
0
  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();
  }