Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] One more question about Server API / File API

Hi Vitaly,

The ETag is basically meant to be used in HTTP cache, so it's quite natural why it's used in HTTP headers along with the location.
In order to better understand why the Location and ETag headers are duplicated in the JSON response, please consider the following scenario.

You are implementing a custom file system plugin for Orion, e. g. google drive. If you take a look at the File API, you'll see why the Location property
is crucial there. You could use it for whatever reason to access the whole file system and perform some operations. Not only on the file which is actually
created, updated or whatever. A more intuitive example is a file system where there's actually no update operation, but only create. How to implement
an update operation over such a file system? You could manually check the file versions, and if it's new, delete the old version using it's location property and save the
new one.

Why duplicate the ETag? Again, imagine a file system where all operations take a lot of time to finish. Why not implement your own cache?
In order to accomplish that without the ETag you'd probably create your own md5 sum or whatever and manually check the versions.
That could be done, but it's error prone and actually slow. So, in this situation the ETag is quite usefull.

I hope that answers your question.

Best regards,
Maciej Bendkowski




From:        "Kozyura, Vitaly" <v.kozyura@xxxxxxx>
To:        "orion-dev@xxxxxxxxxxx" <orion-dev@xxxxxxxxxxx>,
Date:        2013-08-08 11:33
Subject:        [orion-dev] One more question about Server API / File API
Sent by:        orion-dev-bounces@xxxxxxxxxxx




Hi all,
 
I have one more question about Orion File API.
Below is the example response from the wiki page  (http://wiki.eclipse.org/Orion/Server_API/File_API#Copying_a_file_or_directory).
 
Example Response
HTTP/1.1 201 Created
Location: http://example.com/file/MyProj/destination.txt
ETag: "35fd43td3"
Content-Type: application/json
 
{
"Name" : "destination.txt",
"Location" : "http://example.com/file/MyProj/destination.txt",
"ETag" : "35fd43td3",
"LocalTimeStamp" : "01234345009837",
"Directory" : "true"
"Attributes" : {
"ReadOnly" : "false",
"Executable" : "true"
}
}
 
The ETag and the Location are duplicated in the header and in the body.
Is there some reason behind ?
 
 
Thanks in advance,
Vitaly
 _______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orion-dev


Back to the top