On Tue, Aug 10, 2010 at 12:42 PM, Marius Gedminas <marius@gedmin.as> wrote:
How would you like that to be configured?
Option #1:
<browser:resource/resourceDirectory etags="off" /> ?
Option #2:
getMultiAdapter((resource, request), IETag).computeETag() ?
This is maybe a bit problematic, because the actual File object that contains all the data--such as filename--doesn't implement any interfaces. And neither does FileResource.
So maybe Option #1?
I see that your implementation uses last-modified + size, which should generally be fine. However if you're load-balancing across two different servers and the timestamps don't match then the ETag is useless.
Would you prefer a sha1 checksum?
As a default? I'd say last-modified + size is OK.
On a completely different note, I see that the File object reads the whole file into memory.
And it does that twice for every request that results in a 200 response: once to auto-detect the content-type, the second time to return the actual data.
Ouch. That sounds pretty bad. I thought it kept the data in-memory (didn't look close enough at the source). -- Sidnei