> On Oct. 20, 2017, 5:01 a.m., Bill Farner wrote:
> > I don't feel strongly, but `DefaultServlet` can also send an etag header by
> > instead setting `"etags", "true"`.
>
> David McLaughlin wrote:
> Note that it would also need the change here otherwise the browser
> doesn't send the "If-None-Match" header either. The theoritical advantage of
> an E-Tag over Last-Modified is that the cache (should) survive a restart when
> the content doesn't change. But I checked the implementation of the ETags
> from DefaultServlet and it uses the Last-Modified value in there anyway. So I
> think the Last-Modified value (which seems to be set to JAR creation time) is
> what we want here outside of a custom content-addressable strong E-Tag
> implementation.
Sorry that should be "survive a new build."
This is the implementation of the E-Tag generator:
public String getWeakETag(String suffix)
{
try
{
StringBuilder b = new StringBuilder(32);
b.append("W/\"");
String name=getName();
int length=name.length();
long lhash=0;
for (int i=0; i<length;i++)
lhash=31*lhash+name.charAt(i);
B64Code.encode(lastModified()^lhash,b);
B64Code.encode(length()^lhash,b);
b.append(suffix);
b.append('"');
return b.toString();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
- David
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/63176/#review188809
-----------------------------------------------------------
On Oct. 20, 2017, 4:46 a.m., David McLaughlin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63176/
> -----------------------------------------------------------
>
> (Updated Oct. 20, 2017, 4:46 a.m.)
>
>
> Review request for Aurora, Jordan Ly and Santhosh Kumar Shanmugham.
>
>
> Repository: aurora
>
>
> Description
> -------
>
> The Scheduler currently returns last-modified headers for static assets, the
> idea is that the client (the browser) will send HTTP GET requests with an
> If-Modified-Since header and the Jetty Servlet will intercept them and return
> 304s, saving everyone some download time.
>
> But without a max-age or Expires header set, the browsers are just caching
> the assets indefinitely - causing real pains when you want to propagate UI
> changes to users. This sets the max-age of the browser cache to an hour.
>
> I'll have a follow-up review to disable caching of resources completely when
> in Vagrant - because that gets annoying when developing the UI.
>
>
> Diffs
> -----
>
> src/main/java/org/apache/aurora/scheduler/http/JettyServerModule.java
> 93cd20adc28ed700719e472bb2331137a93d1d9d
>
>
> Diff: https://reviews.apache.org/r/63176/diff/1/
>
>
> Testing
> -------
>
> I verified the caching behavior in Chrome with my local Vagrant.
>
>
> Thanks,
>
> David McLaughlin
>
>