0
votes

I have a Jackrabbit WebDAV server running in Tomcat and I want to know how ETag header value is generated. What class is producing it?

How it can be generated using Java based on initial file and it path in Jackrabbit repository?

The intended flow:

  1. Initial file upload to the server
  2. If the client is uploading a new file: calculate ETag and compare it with corresponding ETag of file on the server.
  3. If values the same - do not upload the file, send response to the client. If values deffer - replace the file on server.
2

2 Answers

1
votes

I believe the server will use the jcr:etag property (https://docs.adobe.com/content/docs/en/spec/jcr/2.0/3_Repository_Model.html#3.7.12.1%20mix:etag), otherwise will try to generate something based on timestamp and file length.

0
votes

Later inside Jackrabbit source codes I found this:

if (length > IOUtil.UNDEFINED_LENGTH && modTime > IOUtil.UNDEFINED_TIME) {
    String etag = "\"" + length + "-" + modTime + "\"";
    context.setETag(etag);
}

where: modTime = Callendar#getTimeInMillis();

So etag is produced on the next pattern: size in bytes - modification date converted to Long.