Merge branch '7.0.x'

This commit is contained in:
rstoyanchev
2026-06-22 13:50:10 +01:00
17 changed files with 198 additions and 180 deletions
@@ -334,10 +334,8 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
logger.trace(exchange.getLogPrefix() + matches.size() + " matching mappings: " + matches);
}
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
for (Match match : matches) {
if (match.hasCorsConfig()) {
return PREFLIGHT_AMBIGUOUS_MATCH;
}
if (matches.stream().allMatch(Match::hasCorsConfig)) {
return PREFLIGHT_AMBIGUOUS_MATCH;
}
}
else {
@@ -149,7 +149,7 @@ public class JettyWebSocketSession extends AbstractWebSocketSession<Session> {
if (JettyWebSocketSession.this.handlerCompletionSink != null) {
JettyWebSocketSession.this.handlerCompletionSink.tryEmitError(error);
}
getDelegate().close(StatusCode.SERVER_ERROR, error.getMessage(), Callback.NOOP);
getDelegate().close(StatusCode.SERVER_ERROR, null, Callback.NOOP);
}
void onHandleComplete() {
@@ -131,8 +131,8 @@ class HandlerMethodMappingTests {
@Test // gh-26490
void ambiguousMatchOnPreFlightRequestWithCorsConfig() throws Exception {
this.mapping.registerMapping("/f?o", this.handler, this.method1);
this.mapping.registerMapping("/fo?", this.handler, this.handler.getClass().getMethod("corsHandlerMethod"));
this.mapping.registerMapping("/f?o", this.handler, this.handler.getClass().getMethod("corsHandlerMethod1"));
this.mapping.registerMapping("/fo?", this.handler, this.handler.getClass().getMethod("corsHandlerMethod2"));
MockServerWebExchange exchange = MockServerWebExchange.from(
MockServerHttpRequest.options("https://example.org/foo")
@@ -256,7 +256,12 @@ class HandlerMethodMappingTests {
@RequestMapping
@CrossOrigin(originPatterns = "*")
public void corsHandlerMethod() {
public void corsHandlerMethod1() {
}
@RequestMapping
@CrossOrigin(originPatterns = "*")
public void corsHandlerMethod2() {
}
}