本文整理汇总了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;
}
}