From 7b7dfcaaed1ff9135cdb3f6f22dd67f089b89213 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 13 Mar 2020 14:58:01 +0000 Subject: [PATCH] Polishing contribution See gh-24691 --- .../web/reactive/config/CorsRegistry.java | 12 ++++-------- .../servlet/config/annotation/CorsRegistry.java | 14 ++++---------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java index fb68a1280dd..b0b817d2693 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/config/CorsRegistry.java @@ -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 { *

Exact path mapping URIs (such as {@code "/admin"}) are supported as * well as Ant-style path patterns (such as {@code "/admin/**"}). * - *

The following defaults are applied to the {@link CorsRegistration}: - *

+ *

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); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java index ead009eb057..da4c1493ad8 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/CorsRegistry.java @@ -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 { * *

Exact path mapping URIs (such as {@code "/admin"}) are supported as * well as Ant-style path patterns (such as {@code "/admin/**"}). - *

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. * - *

The following defaults are applied to the {@link CorsRegistration}: - *

+ *

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);