List of usage examples for com.vaadin.server VaadinRequest getDateHeader
public long getDateHeader(String name);
From source file:com.haulmont.cuba.web.sys.CubaWebJarsHandler.java
License:Apache License
protected boolean browserHasNewestVersion(VaadinRequest request, long resourceLastModifiedTimestamp) { if (resourceLastModifiedTimestamp < 1) { // We do not know when it was modified so the browser cannot have an // up-to-date version return false; }//from w w w. j a v a2 s .c o m /* * The browser can request the resource conditionally using an * If-Modified-Since header. Check this against the last modification * time. */ try { // If-Modified-Since represents the timestamp of the version cached // in the browser long headerIfModifiedSince = request.getDateHeader("If-Modified-Since"); if (headerIfModifiedSince >= resourceLastModifiedTimestamp) { // Browser has this an up-to-date version of the resource return true; } } catch (Exception e) { // Failed to parse header. Fail silently - the browser does not have // an up-to-date version in its cache. } return false; }