Skip to content

Commit

Permalink
Implement MatchableHandlerMapping in RouterFunctionMapping
Browse files Browse the repository at this point in the history
See gh-32221
Closes gh-32222
  • Loading branch information
poutsma committed Feb 8, 2024
1 parent 5fd9fab commit 667e4e7
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -37,6 +37,8 @@
import org.springframework.web.servlet.function.RouterFunctions;
import org.springframework.web.servlet.function.ServerRequest;
import org.springframework.web.servlet.handler.AbstractHandlerMapping;
import org.springframework.web.servlet.handler.MatchableHandlerMapping;
import org.springframework.web.servlet.handler.RequestMatchResult;
import org.springframework.web.util.pattern.PathPattern;
import org.springframework.web.util.pattern.PathPatternParser;

Expand All @@ -53,7 +55,7 @@
* @author Brian Clozel
* @since 5.2
*/
public class RouterFunctionMapping extends AbstractHandlerMapping implements InitializingBean {
public class RouterFunctionMapping extends AbstractHandlerMapping implements InitializingBean, MatchableHandlerMapping {

@Nullable
private RouterFunction<?> routerFunction;
Expand Down Expand Up @@ -223,4 +225,9 @@ private void setAttributes(HttpServletRequest servletRequest, ServerRequest requ
servletRequest.setAttribute(RouterFunctions.REQUEST_ATTRIBUTE, request);
}

@Nullable
@Override
public RequestMatchResult match(HttpServletRequest request, String pattern) {
throw new UnsupportedOperationException("This HandlerMapping uses PathPatterns");
}
}

0 comments on commit 667e4e7

Please sign in to comment.