ResourceServlet.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:class-guard 作者:
/**
 * Return the file timestamp for the given resource.
 * @param resourceUrl the URL of the resource
 * @return the file timestamp in milliseconds, or -1 if not determinable
 */
protected long getFileTimestamp(String resourceUrl) {
    ServletContextResource resource = new ServletContextResource(getServletContext(), resourceUrl);
    try {
        long lastModifiedTime = resource.lastModified();
        if (logger.isDebugEnabled()) {
            logger.debug("Last-modified timestamp of " + resource + " is " + lastModifiedTime);
        }
        return lastModifiedTime;
    }
    catch (IOException ex) {
        logger.warn("Couldn't retrieve last-modified timestamp of [" + resource +
                "] - using ResourceServlet startup time");
        return -1;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号