Browse Source

Polishing contribution

See gh-24691
pull/24697/head
Rossen Stoyanchev 6 years ago
parent
commit
7b7dfcaaed
  1. 12
      spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java
  2. 14
      spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java

12
spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2020 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.
@ -42,13 +42,9 @@ public class CorsRegistry { @@ -42,13 +42,9 @@ public class CorsRegistry {
* <p>Exact path mapping URIs (such as {@code "/admin"}) are supported as
* well as Ant-style path patterns (such as {@code "/admin/**"}).
*
* <p>The following defaults are applied to the {@link CorsRegistration}:
* <ul>
* <li>Allow all origins.</li>
* <li>Allow "simple" methods {@code GET}, {@code HEAD} and {@code POST}.</li>
* <li>Allow all headers.</li>
* <li>Set max age to 1800 seconds (30 minutes).</li>
* </ul>
* <p>By default, the {@code CorsConfiguration} for this mapping is
* initialized with default values as described in
* {@link CorsConfiguration#applyPermitDefaultValues()}.
*/
public CorsRegistration addMapping(String pathPattern) {
CorsRegistration registration = new CorsRegistration(pathPattern);

14
spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 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.
@ -42,16 +42,10 @@ public class CorsRegistry { @@ -42,16 +42,10 @@ public class CorsRegistry {
*
* <p>Exact path mapping URIs (such as {@code "/admin"}) are supported as
* well as Ant-style path patterns (such as {@code "/admin/**"}).
* <p>By default, all origins, all headers and {@code GET}, {@code HEAD},
* and {@code POST} methods are allowed, and the max age is set to 30 minutes.
*
* <p>The following defaults are applied to the {@link CorsRegistration}:
* <ul>
* <li>Allow all origins.</li>
* <li>Allow "simple" methods {@code GET}, {@code HEAD} and {@code POST}.</li>
* <li>Allow all headers.</li>
* <li>Set max age to 1800 seconds (30 minutes).</li>
* </ul>
* <p>By default, the {@code CorsConfiguration} for this mapping is
* initialized with default values as described in
* {@link CorsConfiguration#applyPermitDefaultValues()}.
*/
public CorsRegistration addMapping(String pathPattern) {
CorsRegistration registration = new CorsRegistration(pathPattern);

Loading…
Cancel
Save