提交 321d7b0b 编写于 作者: N nkjackzhang 提交者: Juergen Hoeller

Put CacheControl.empty() in else part.

Make sure the constructor of `CacheControl` being invoked only once.
上级 795e5d30
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -201,7 +201,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
private CacheControl parseCacheControl(Element element) {
CacheControl cacheControl = CacheControl.empty();
CacheControl cacheControl;
if ("true".equals(element.getAttribute("no-cache"))) {
cacheControl = CacheControl.noCache();
}
......@@ -211,6 +211,10 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
else if (element.hasAttribute("max-age")) {
cacheControl = CacheControl.maxAge(Long.parseLong(element.getAttribute("max-age")), TimeUnit.SECONDS);
}
else {
cacheControl = CacheControl.empty();
}
if ("true".equals(element.getAttribute("must-revalidate"))) {
cacheControl = cacheControl.mustRevalidate();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册