提交 f0c08130 编写于 作者: S Sam Brannen

Change semantics of @CrossOrigin's maxAge regarding negative values

上级 72b44af8
......@@ -84,7 +84,7 @@ public @interface CrossOrigin {
* The maximum age (in seconds) of the cache duration for pre-flight responses.
* <p>This property controls the value of the {@code Access-Control-Max-Age}
* header in the pre-flight response.
* <p>A value of {@code -1} means <em>undefined</em>.
* <p>A negative value means <em>undefined</em>.
* <p>Setting this to a reasonable value can reduce the number of pre-flight
* request/response interactions required by the browser.
* <p>Defaults to {@code 1800} seconds (i.e., 30 minutes).
......
......@@ -340,7 +340,8 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
throw new IllegalStateException("@CrossOrigin's allowCredentials value must be \"true\", \"false\", "
+ "or an empty string (\"\"); current value is [" + allowCredentials + "].");
}
if (annotation.maxAge() != -1 && config.getMaxAge() == null) {
if ((annotation.maxAge() >= 0) && (config.getMaxAge() == null)) {
config.setMaxAge(annotation.maxAge());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册