in extscript-core-root/extscript-core/src/main/java/org/apache/myfaces/extensions/scripting/jsf/resources/deprecated/ResourceImpl.java [215:259]
public Map<String, String> getResponseHeaders() {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext.getApplication().getResourceHandler().isResourceRequest(facesContext)) {
Map<String, String> headers = new HashMap<String, String>();
long lastModified;
try {
lastModified = ResourceLoaderUtils.getResourceLastModified(this.getURL());
} catch (IOException e) {
lastModified = -1;
}
// Here we have two cases: If the file could contain EL Expressions
// the last modified time is the greatest value between application startup and
// the value from file.
if (this.couldResourceContainValueExpressions() &&
lastModified < _resourceHandlerSupport.getStartupTime()) {
lastModified = _resourceHandlerSupport.getStartupTime();
} else if (_resourceMeta instanceof AliasResourceMetaImpl &&
lastModified < _resourceHandlerSupport.getStartupTime()) {
// If the resource meta is aliased, the last modified time is the greatest
// value between application startup and the value from file.
lastModified = _resourceHandlerSupport.getStartupTime();
}
if (lastModified >= 0) {
headers.put("Last-Modified", ResourceLoaderUtils.formatDateHeader(lastModified));
long expires;
if (facesContext.isProjectStage(ProjectStage.Development)) {
// Force to expire now to prevent caching on development time.
expires = System.currentTimeMillis();
} else {
expires = System.currentTimeMillis() + _resourceHandlerSupport.getMaxTimeExpires();
}
headers.put("Expires", ResourceLoaderUtils.formatDateHeader(expires));
}
return headers;
} else {
//No need to return headers
return Collections.emptyMap();
}
}