本文整理匯總了Java中org.springframework.core.io.Resource.lastModified方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.lastModified方法的具體用法?Java Resource.lastModified怎麽用?Java Resource.lastModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.core.io.Resource
的用法示例。
在下文中一共展示了Resource.lastModified方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refreshProperties
import org.springframework.core.io.Resource; //導入方法依賴的package包/類
@Override
protected PropertiesHolder refreshProperties(String filename, PropertiesHolder propHolder) {
Properties properties = new Properties();
long lastModified = -1;
try {
Resource[] resources = resolver.getResources(filename + "*" + PROPERTIES_SUFFIX);
for (Resource resource : resources) {
String sourcePath = resource.getURI().toString().replace(PROPERTIES_SUFFIX, "");
PropertiesHolder holder = super.refreshProperties(sourcePath, propHolder);
properties.putAll(holder.getProperties());
if (lastModified < resource.lastModified())
lastModified = resource.lastModified();
}
} catch (IOException ignored) {
throw new BusinessException("load message source error:" + ignored);
}
return new PropertiesHolder(properties, lastModified);
}
示例2: getLastModified
import org.springframework.core.io.Resource; //導入方法依賴的package包/類
@Override
public long getLastModified(Object templateSource) {
Resource resource = (Resource) templateSource;
try {
return resource.lastModified();
}
catch (IOException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not obtain last-modified timestamp for FreeMarker template in " +
resource + ": " + ex);
}
return -1;
}
}
示例3: getLastModified
import org.springframework.core.io.Resource; //導入方法依賴的package包/類
@Override
public long getLastModified(Object templateSource) {
Resource resource = (Resource) templateSource;
try {
return resource.lastModified();
} catch (IOException ex) {
return -1;
}
}