Skip to content

Commit 667e4e7

Browse files
committed
Implement MatchableHandlerMapping in RouterFunctionMapping
See gh-32221 Closes gh-32222
1 parent 5fd9fab commit 667e4e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/RouterFunctionMapping.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@
3737
import org.springframework.web.servlet.function.RouterFunctions;
3838
import org.springframework.web.servlet.function.ServerRequest;
3939
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
40+
import org.springframework.web.servlet.handler.MatchableHandlerMapping;
41+
import org.springframework.web.servlet.handler.RequestMatchResult;
4042
import org.springframework.web.util.pattern.PathPattern;
4143
import org.springframework.web.util.pattern.PathPatternParser;
4244

@@ -53,7 +55,7 @@
5355
* @author Brian Clozel
5456
* @since 5.2
5557
*/
56-
public class RouterFunctionMapping extends AbstractHandlerMapping implements InitializingBean {
58+
public class RouterFunctionMapping extends AbstractHandlerMapping implements InitializingBean, MatchableHandlerMapping {
5759

5860
@Nullable
5961
private RouterFunction<?> routerFunction;
@@ -223,4 +225,9 @@ private void setAttributes(HttpServletRequest servletRequest, ServerRequest requ
223225
servletRequest.setAttribute(RouterFunctions.REQUEST_ATTRIBUTE, request);
224226
}
225227

228+
@Nullable
229+
@Override
230+
public RequestMatchResult match(HttpServletRequest request, String pattern) {
231+
throw new UnsupportedOperationException("This HandlerMapping uses PathPatterns");
232+
}
226233
}

0 commit comments

Comments
 (0)