Skip to content

Commit 46782c3

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents d76e82f + 7a0162b commit 46782c3

3 files changed

Lines changed: 38 additions & 30 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33

44
Spring Cloud is released under the non-restrictive Apache 2.0 license,
55
and follows a very standard Github development process, using Github
6-
tracker for issues and merging pull requests into master. If you want
6+
tracker for issues and merging pull requests into main. If you want
77
to contribute even something trivial please do not hesitate, but
88
follow the guidelines below.
99

10-
## Sign the Contributor License Agreement
11-
Before we accept a non-trivial patch or pull request we will need you to sign the
12-
[Contributor License Agreement](https://cla.pivotal.io/sign/spring).
13-
Signing the contributor's agreement does not grant anyone commit rights to the main
14-
repository, but it does mean that we can accept your contributions, and you will get an
15-
author credit if we do. Active contributors might be asked to join the core team, and
16-
given the ability to merge pull requests.
10+
## Developer Certificate of Origin (DCO)
11+
All commits must include a `Signed-off-by` trailer at the end of each commit message
12+
to indicate that the contributor agrees to the
13+
[Developer Certificate of Origin](https://developercertificate.org/).
14+
You can add this automatically by using `git commit -s`.
15+
16+
For additional details, please refer to the blog post
17+
[Hello DCO, Goodbye CLA: Simplifying Contributions to Spring](https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring).
1718

1819
## Code of Conduct
1920
This project adheres to the Contributor Covenant [Code of conduct](https://github.com/spring-cloud/spring-cloud-build/blob/main/docs/modules/ROOT/partials/code-of-conduct.adoc). By participating, you are expected to uphold this code. Please report
20-
unacceptable behavior to spring-code-of-conduct@pivotal.io.
21+
unacceptable behavior to code-of-conduct@spring.io.
2122

2223
## Code Conventions and Housekeeping
2324
None of these is essential for a pull request, but they will all help. They can also be
@@ -26,7 +27,7 @@ added after the original pull request but before a merge.
2627
* Use the Spring Framework code format conventions. If you use Eclipse
2728
you can import formatter settings using the
2829
`eclipse-code-formatter.xml` file from the
29-
[Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the
30+
[Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the
3031
[Eclipse Code Formatter Plugin](https://plugins.jetbrains.com/plugin/6546) to import the same file.
3132
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
3233
`@author` tag identifying you, and preferably at least a paragraph on what the class is
@@ -37,7 +38,7 @@ added after the original pull request but before a merge.
3738
than cosmetic changes).
3839
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
3940
* A few unit tests would help a lot as well -- someone has to do it.
40-
* If no-one else is using your branch, please rebase it against the current master (or
41+
* If no-one else is using your branch, please rebase it against the current main (or
4142
other target branch in the main project).
4243
* When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
4344
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit

docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/cors-configuration.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ The following example configures CORS:
1717
spring:
1818
cloud:
1919
gateway:
20-
globalcors:
21-
cors-configurations:
22-
'[/**]':
23-
allowedOrigins: "https://docs.spring.io"
24-
allowedMethods:
25-
- GET
20+
server:
21+
webflux:
22+
globalcors:
23+
cors-configurations:
24+
'[/**]':
25+
allowedOrigins: "https://docs.spring.io"
26+
allowedMethods:
27+
- GET
2628
----
2729

2830
In the preceding example, CORS requests are allowed from requests that originate from `docs.spring.io` for all GET requested paths.
2931

30-
To provide the same CORS configuration to requests that are not handled by some gateway route predicate, set the `spring.cloud.gateway.globalcors.add-to-simple-url-handler-mapping` property to `true`.
32+
To provide the same CORS configuration to requests that are not handled by some gateway route predicate, set the `spring.cloud.gateway.server.webflux.globalcors.add-to-simple-url-handler-mapping` property to `true`.
3133
This is useful when you try to support CORS preflight requests and your route predicate does not evaluate to `true` because the HTTP method is `options`.
3234

3335
[[route-cors-configuration]]

spring-cloud-gateway-server-webmvc/src/main/java/org/springframework/cloud/gateway/server/mvc/predicate/GatewayRequestPredicates.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,30 @@ public static RequestPredicate method(HttpMethod... methods) {
128128
return RequestPredicates.methods(methods);
129129
}
130130

131+
/**
132+
* Return a {@code RequestPredicate} that tests the request host against the given
133+
* host pattern.
134+
* @param pattern the host pattern to match
135+
* @return a predicate that tests against the given host pattern
136+
*/
131137
public static RequestPredicate host(String pattern) {
132138
Objects.requireNonNull(pattern, "'pattern' must not be null");
133139
return hostPredicates(DEFAULT_HOST_INSTANCE).apply(pattern);
134140
}
135141

142+
/**
143+
* Return a {@code RequestPredicate} that tests the request host against the given
144+
* host patterns.
145+
* @param patterns the list of patterns to match
146+
* @return a predicate that tests against the given host patterns
147+
*/
136148
@Shortcut(type = Type.LIST)
137149
public static RequestPredicate host(String... patterns) {
138150
Assert.notEmpty(patterns, "'patterns' must not be empty");
139-
RequestPredicate requestPredicate = hostPredicates(DEFAULT_HOST_INSTANCE).apply(patterns[0]);
140-
// I'm sure there's a functional way to do this, I'm just tired...
141-
for (int i = 1; i < patterns.length; i++) {
142-
requestPredicate = requestPredicate.or(hostPredicates(DEFAULT_HOST_INSTANCE).apply(patterns[i]));
143-
}
144-
return requestPredicate;
151+
return Arrays.stream(patterns)
152+
.map(pattern -> hostPredicates(DEFAULT_HOST_INSTANCE).apply(pattern))
153+
.reduce(RequestPredicate::or)
154+
.orElseThrow();
145155
}
146156

147157
/**
@@ -180,12 +190,7 @@ public static RequestPredicate path(String pattern) {
180190
@Shortcut(type = Type.LIST)
181191
public static RequestPredicate path(String... patterns) {
182192
Assert.notEmpty(patterns, "'patterns' must not be empty");
183-
RequestPredicate requestPredicate = RequestPredicates.path(patterns[0]);
184-
// I'm sure there's a functional way to do this, I'm just tired...
185-
for (int i = 1; i < patterns.length; i++) {
186-
requestPredicate = requestPredicate.or(RequestPredicates.path(patterns[i]));
187-
}
188-
return requestPredicate;
193+
return Arrays.stream(patterns).map(RequestPredicates::path).reduce(RequestPredicate::or).orElseThrow();
189194
}
190195

191196
/**

0 commit comments

Comments
 (0)