Update CORS Javadoc in spring-websocket

Closes gh-26753
This commit is contained in:
Rossen Stoyanchev
2021-04-13 17:43:40 +01:00
parent b73eb51cb1
commit 27c4e74e24
6 changed files with 124 additions and 75 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 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.
@@ -46,10 +46,14 @@ public class CorsRegistration {
/**
* A list of origins for which cross-origin requests are allowed. Please,
* see {@link CorsConfiguration#setAllowedOrigins(List)} for details.
* <p>By default all origins are allowed unless {@code originPatterns} is
* also set in which case {@code originPatterns} is used instead.
* Set the origins for which cross-origin requests are allowed from a browser.
* Please, refer to {@link CorsConfiguration#setAllowedOrigins(List)} for
* format details and other considerations.
*
* <p>By default, all origins are allowed, but if
* {@link #allowedOriginPatterns(String...) allowedOriginPatterns} is also
* set, then that takes precedence.
* @see #allowedOriginPatterns(String...)
*/
public CorsRegistration allowedOrigins(String... origins) {
this.config.setAllowedOrigins(Arrays.asList(origins));
@@ -57,9 +61,11 @@ public class CorsRegistration {
}
/**
* Alternative to {@link #allowCredentials} that supports origins declared
* via wildcard patterns. Please, see
* @link CorsConfiguration#setAllowedOriginPatterns(List)} for details.
* Alternative to {@link #allowedOrigins(String...)} that supports more
* flexible patterns for specifying the origins for which cross-origin
* requests are allowed from a browser. Please, refer to
* {@link CorsConfiguration#setAllowedOriginPatterns(List)} for format
* details and other considerations.
* <p>By default this is not set.
* @since 5.3
*/