diff --git a/spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java b/spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java index 35268a886d..737b5fdc6e 100644 --- a/spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java +++ b/spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java @@ -80,7 +80,9 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource @Override public CorsConfiguration getCorsConfiguration(ServerWebExchange exchange) { - String lookupPath = exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE).get().getPath(); + String lookupPath = exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE) + .map(LookupPath::getPath) + .orElseThrow(() -> new IllegalStateException("No LookupPath attribute.")); for (Map.Entry entry : this.corsConfigurations.entrySet()) { if (this.pathMatcher.match(entry.getKey(), lookupPath)) { return entry.getValue(); diff --git a/spring-web/src/main/java/org/springframework/web/server/support/LookupPath.java b/spring-web/src/main/java/org/springframework/web/server/support/LookupPath.java index 7d9a597535..3bc7a9b5a1 100644 --- a/spring-web/src/main/java/org/springframework/web/server/support/LookupPath.java +++ b/spring-web/src/main/java/org/springframework/web/server/support/LookupPath.java @@ -29,18 +29,21 @@ public final class LookupPath { public static final String LOOKUP_PATH_ATTRIBUTE = LookupPath.class.getName(); + private final String path; private final int fileExtStartIndex; private final int fileExtEndIndex; + public LookupPath(String path, int fileExtStartIndex, int fileExtEndIndex) { this.path = path; this.fileExtStartIndex = fileExtStartIndex; this.fileExtEndIndex = fileExtEndIndex; } + public String getPath() { return this.path; } diff --git a/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java b/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java index 4fe628ed94..26c98ea9ee 100644 --- a/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java +++ b/spring-web/src/test/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSourceTests.java @@ -41,7 +41,7 @@ public class UrlBasedCorsConfigurationSourceTests { @Test public void empty() { ServerWebExchange exchange = MockServerHttpRequest.get("/bar/test.html").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); assertNull(this.configSource.getCorsConfiguration(exchange)); } @@ -51,11 +51,11 @@ public class UrlBasedCorsConfigurationSourceTests { this.configSource.registerCorsConfiguration("/bar/**", config); ServerWebExchange exchange = MockServerHttpRequest.get("/foo/test.html").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); assertNull(this.configSource.getCorsConfiguration(exchange)); exchange = MockServerHttpRequest.get("/bar/test.html").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); assertEquals(config, this.configSource.getCorsConfiguration(exchange)); } @@ -64,10 +64,9 @@ public class UrlBasedCorsConfigurationSourceTests { this.configSource.getCorsConfigurations().put("/**", new CorsConfiguration()); } - public void setLookupPathAttribute(ServerWebExchange exchange) { - HttpRequestPathHelper helper = new HttpRequestPathHelper(); + private void initLookupPath(ServerWebExchange exchange) { exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, - helper.getLookupPathForRequest(exchange)); + new HttpRequestPathHelper().getLookupPathForRequest(exchange)); } } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java b/spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java index 92d8937abb..cc83e7e625 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java @@ -175,12 +175,12 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im } protected LookupPath getLookupPath(ServerWebExchange exchange) { - Optional attribute = exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE); - return attribute.orElseGet(() -> { - LookupPath lookupPath = createLookupPath(exchange); - exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, lookupPath); - return lookupPath; - }); + return exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE) + .orElseGet(() -> { + LookupPath lookupPath = createLookupPath(exchange); + exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, lookupPath); + return lookupPath; + }); } protected LookupPath createLookupPath(ServerWebExchange exchange) { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java index 40c822c0a8..e157ab096a 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java @@ -185,7 +185,9 @@ public class ResourceUrlProvider implements ApplicationListenergetAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE) + .orElseGet(() -> getPathHelper().getLookupPathForRequest(exchange)); return requestPath.indexOf(lookupPath.getPath()); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java index 6274e96ee2..8de476fdd6 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java @@ -29,8 +29,8 @@ import java.util.Set; import org.springframework.util.PathMatcher; import org.springframework.util.StringUtils; -import org.springframework.web.server.support.LookupPath; import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.server.support.LookupPath; import org.springframework.web.util.pattern.ParsingPathMatcher; /** @@ -187,8 +187,7 @@ public final class PatternsRequestCondition extends AbstractRequestConditiongetAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE).get(); + LookupPath lookupPath = getLookupPath(exchange); List matches = getMatchingPatterns(lookupPath); return matches.isEmpty() ? null : @@ -196,6 +195,11 @@ public final class PatternsRequestCondition extends AbstractRequestConditiongetAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE) + .orElseThrow(() -> new IllegalStateException("No LookupPath attribute.")); + } + /** * Find the patterns matching the given lookup path. Invoking this method should * yield results equivalent to those of calling @@ -259,8 +263,7 @@ public final class PatternsRequestCondition extends AbstractRequestConditiongetAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE).get(); + LookupPath lookupPath = getLookupPath(exchange); Comparator patternComparator = this.pathMatcher.getPatternComparator(lookupPath.getPath()); Iterator iterator = this.patterns.iterator(); Iterator iteratorOther = other.patterns.iterator(); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java index 39b61b0175..a23666827c 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java @@ -32,13 +32,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.method.HandlerMethod; -import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; import org.springframework.web.reactive.accept.RequestedContentTypeResolver; +import org.springframework.web.reactive.accept.RequestedContentTypeResolverBuilder; import org.springframework.web.reactive.result.condition.RequestCondition; import org.springframework.web.reactive.result.method.RequestMappingInfo; import org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping; -import org.springframework.web.server.support.LookupPath; -import org.springframework.web.server.ServerWebExchange; /** * An extension of {@link RequestMappingInfoHandlerMapping} that creates @@ -169,11 +167,6 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi AnnotatedElementUtils.hasAnnotation(beanType, RequestMapping.class)); } - @Override - protected LookupPath createLookupPath(ServerWebExchange exchange) { - return getPathHelper().getLookupPathForRequest(exchange); - } - /** * Uses method and type-level @{@link RequestMapping} annotations to create * the RequestMappingInfo. diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java index 82fb55fec0..c70ee6bff2 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java @@ -257,7 +257,9 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport * Use the request path the leading and trailing slash stripped. */ private String getDefaultViewName(ServerWebExchange exchange) { - String path = exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE).get().getPath(); + String path = exchange.getAttribute(LookupPath.LOOKUP_PATH_ATTRIBUTE) + .map(LookupPath::getPath) + .orElseThrow(() -> new IllegalStateException("No LookupPath attribute.")); if (path.startsWith("/")) { path = path.substring(1); } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/PatternsRequestConditionTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/PatternsRequestConditionTests.java index b92fc911e3..d29f489010 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/PatternsRequestConditionTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/PatternsRequestConditionTests.java @@ -22,9 +22,9 @@ import java.util.Set; import org.junit.Test; import org.springframework.mock.http.server.reactive.test.MockServerWebExchange; +import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.support.HttpRequestPathHelper; import org.springframework.web.server.support.LookupPath; -import org.springframework.web.server.ServerWebExchange; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -82,7 +82,7 @@ public class PatternsRequestConditionTests { @Test public void matchDirectPath() throws Exception { PatternsRequestCondition condition = new PatternsRequestCondition("/foo"); - PatternsRequestCondition match = condition.getMatchingCondition(createExchange("/foo")); + PatternsRequestCondition match = condition.getMatchingCondition(initExchange("/foo")); assertNotNull(match); } @@ -90,7 +90,7 @@ public class PatternsRequestConditionTests { @Test public void matchPattern() throws Exception { PatternsRequestCondition condition = new PatternsRequestCondition("/foo/*"); - PatternsRequestCondition match = condition.getMatchingCondition(createExchange("/foo/bar")); + PatternsRequestCondition match = condition.getMatchingCondition(initExchange("/foo/bar")); assertNotNull(match); } @@ -98,7 +98,7 @@ public class PatternsRequestConditionTests { @Test public void matchSortPatterns() throws Exception { PatternsRequestCondition condition = new PatternsRequestCondition("/*/*", "/foo/bar", "/foo/*"); - PatternsRequestCondition match = condition.getMatchingCondition(createExchange("/foo/bar")); + PatternsRequestCondition match = condition.getMatchingCondition(initExchange("/foo/bar")); PatternsRequestCondition expected = new PatternsRequestCondition("/foo/bar", "/foo/*", "/*/*"); assertEquals(expected, match); @@ -106,7 +106,7 @@ public class PatternsRequestConditionTests { @Test public void matchSuffixPattern() throws Exception { - ServerWebExchange exchange = createExchange("/foo.html"); + ServerWebExchange exchange = initExchange("/foo.html"); PatternsRequestCondition condition = new PatternsRequestCondition("/{foo}"); PatternsRequestCondition match = condition.getMatchingCondition(exchange); @@ -129,13 +129,13 @@ public class PatternsRequestConditionTests { Set extensions = Collections.singleton("json"); PatternsRequestCondition condition = new PatternsRequestCondition(patterns, null, true, false, extensions); - MockServerWebExchange exchange = createExchange("/jobs/my.job"); + MockServerWebExchange exchange = initExchange("/jobs/my.job"); PatternsRequestCondition match = condition.getMatchingCondition(exchange); assertNotNull(match); assertEquals("/jobs/{jobName}", match.getPatterns().iterator().next()); - exchange = createExchange("/jobs/my.job.json"); + exchange = initExchange("/jobs/my.job.json"); match = condition.getMatchingCondition(exchange); assertNotNull(match); @@ -152,7 +152,7 @@ public class PatternsRequestConditionTests { PatternsRequestCondition combined = condition1.combine(condition2); - MockServerWebExchange exchange = createExchange("/prefix/suffix.json"); + MockServerWebExchange exchange = initExchange("/prefix/suffix.json"); PatternsRequestCondition match = combined.getMatchingCondition(exchange); assertNotNull(match); @@ -160,7 +160,7 @@ public class PatternsRequestConditionTests { @Test public void matchTrailingSlash() throws Exception { - MockServerWebExchange exchange = createExchange("/foo/"); + MockServerWebExchange exchange = initExchange("/foo/"); PatternsRequestCondition condition = new PatternsRequestCondition("/foo"); PatternsRequestCondition match = condition.getMatchingCondition(exchange); @@ -175,7 +175,7 @@ public class PatternsRequestConditionTests { assertEquals("Trailing slash should be insensitive to useSuffixPatternMatch settings (SPR-6164, SPR-5636)", "/foo/", match.getPatterns().iterator().next()); - exchange = createExchange("/foo/"); + exchange = initExchange("/foo/"); condition = new PatternsRequestCondition(new String[] {"/foo"}, null, false, false, null); match = condition.getMatchingCondition(exchange); @@ -185,7 +185,7 @@ public class PatternsRequestConditionTests { @Test public void matchPatternContainsExtension() throws Exception { PatternsRequestCondition condition = new PatternsRequestCondition("/foo.jpg"); - PatternsRequestCondition match = condition.getMatchingCondition(createExchange("/foo.html")); + PatternsRequestCondition match = condition.getMatchingCondition(initExchange("/foo.html")); assertNull(match); } @@ -195,7 +195,7 @@ public class PatternsRequestConditionTests { PatternsRequestCondition c1 = new PatternsRequestCondition("/foo*"); PatternsRequestCondition c2 = new PatternsRequestCondition("/foo*"); - assertEquals(0, c1.compareTo(c2, createExchange("/foo"))); + assertEquals(0, c1.compareTo(c2, initExchange("/foo"))); } @Test @@ -203,12 +203,12 @@ public class PatternsRequestConditionTests { PatternsRequestCondition c1 = new PatternsRequestCondition("/fo*"); PatternsRequestCondition c2 = new PatternsRequestCondition("/foo"); - assertEquals(1, c1.compareTo(c2, createExchange("/foo"))); + assertEquals(1, c1.compareTo(c2, initExchange("/foo"))); } @Test public void compareNumberOfMatchingPatterns() throws Exception { - ServerWebExchange exchange = createExchange("/foo.html"); + ServerWebExchange exchange = initExchange("/foo.html"); PatternsRequestCondition c1 = new PatternsRequestCondition("/foo", "*.jpeg"); PatternsRequestCondition c2 = new PatternsRequestCondition("/foo", "*.html"); @@ -220,10 +220,10 @@ public class PatternsRequestConditionTests { assertEquals(1, match1.compareTo(match2, exchange)); } - private MockServerWebExchange createExchange(String path) { + private MockServerWebExchange initExchange(String path) { MockServerWebExchange exchange = get(path).toExchange(); - HttpRequestPathHelper helper = new HttpRequestPathHelper(); - exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, helper.getLookupPathForRequest(exchange)); + exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, + new HttpRequestPathHelper().getLookupPathForRequest(exchange)); return exchange; } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java index ac32a58d28..a20a0de5f4 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java @@ -67,7 +67,7 @@ public class RequestMappingInfoTests { @Test public void matchPatternsCondition() { MockServerWebExchange exchange = MockServerHttpRequest.get("/foo").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo*", "/bar").build(); RequestMappingInfo expected = paths("/foo*").build(); @@ -83,7 +83,7 @@ public class RequestMappingInfoTests { @Test public void matchParamsCondition() { ServerWebExchange exchange = MockServerHttpRequest.get("/foo?foo=bar").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); @@ -99,7 +99,7 @@ public class RequestMappingInfoTests { @Test public void matchHeadersCondition() { ServerWebExchange exchange = MockServerHttpRequest.get("/foo").header("foo", "bar").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo").headers("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); @@ -115,7 +115,7 @@ public class RequestMappingInfoTests { @Test public void matchConsumesCondition() { ServerWebExchange exchange = MockServerHttpRequest.post("/foo").contentType(MediaType.TEXT_PLAIN).toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo").consumes("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); @@ -131,7 +131,7 @@ public class RequestMappingInfoTests { @Test public void matchProducesCondition() { ServerWebExchange exchange = MockServerHttpRequest.get("/foo").accept(MediaType.TEXT_PLAIN).toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo").produces("text/plain").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); @@ -147,7 +147,7 @@ public class RequestMappingInfoTests { @Test public void matchCustomCondition() { ServerWebExchange exchange = MockServerHttpRequest.get("/foo?foo=bar").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); RequestMappingInfo info = paths("/foo").params("foo=bar").build(); RequestMappingInfo match = info.getMatchingCondition(exchange); @@ -169,7 +169,7 @@ public class RequestMappingInfoTests { RequestMappingInfo oneMethodOneParam = paths().methods(RequestMethod.GET).params("foo").build(); ServerWebExchange exchange = MockServerHttpRequest.get("/foo").toExchange(); - setLookupPathAttribute(exchange); + initLookupPath(exchange); Comparator comparator = (info, otherInfo) -> info.compareTo(otherInfo, exchange); List list = asList(none, oneMethod, oneMethodOneParam); @@ -279,9 +279,9 @@ public class RequestMappingInfoTests { assertNull("Pre-flight should match the ACCESS_CONTROL_REQUEST_METHOD", match); } - public void setLookupPathAttribute(ServerWebExchange exchange) { - HttpRequestPathHelper helper = new HttpRequestPathHelper(); - exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, helper.getLookupPathForRequest(exchange)); + private void initLookupPath(ServerWebExchange exchange) { + exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, + new HttpRequestPathHelper().getLookupPathForRequest(exchange)); } } diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java index 3fcf341e82..49753dd206 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java @@ -219,17 +219,17 @@ public class ViewResolutionResultHandlerTests { ViewResolutionResultHandler handler = resultHandler(new TestViewResolver("account")); MockServerWebExchange exchange = get("/account").toExchange(); - addLookupPathAttribute(exchange); + initLookupPath(exchange); handler.handleResult(exchange, result).block(Duration.ofMillis(5000)); assertResponseBody(exchange, "account: {id=123}"); exchange = get("/account/").toExchange(); - addLookupPathAttribute(exchange); + initLookupPath(exchange); handler.handleResult(exchange, result).block(Duration.ofMillis(5000)); assertResponseBody(exchange, "account: {id=123}"); exchange = get("/account.123").toExchange(); - addLookupPathAttribute(exchange); + initLookupPath(exchange); handler.handleResult(exchange, result).block(Duration.ofMillis(5000)); assertResponseBody(exchange, "account: {id=123}"); } @@ -256,7 +256,7 @@ public class ViewResolutionResultHandlerTests { HandlerResult handlerResult = new HandlerResult(new Object(), value, returnType, this.bindingContext); MockServerWebExchange exchange = get("/account").accept(APPLICATION_JSON).toExchange(); - addLookupPathAttribute(exchange); + initLookupPath(exchange); TestView defaultView = new TestView("jsonView", APPLICATION_JSON); @@ -307,9 +307,9 @@ public class ViewResolutionResultHandlerTests { assertEquals("/", response.getHeaders().getLocation().toString()); } - private void addLookupPathAttribute(ServerWebExchange exchange) { - HttpRequestPathHelper helper = new HttpRequestPathHelper(); - exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, helper.getLookupPathForRequest(exchange)); + private void initLookupPath(ServerWebExchange exchange) { + exchange.getAttributes().put(LookupPath.LOOKUP_PATH_ATTRIBUTE, + new HttpRequestPathHelper().getLookupPathForRequest(exchange)); } @@ -333,7 +333,7 @@ public class ViewResolutionResultHandlerTests { model.addAttribute("id", "123"); HandlerResult result = new HandlerResult(new Object(), returnValue, returnType, this.bindingContext); MockServerWebExchange exchange = get(path).toExchange(); - addLookupPathAttribute(exchange); + initLookupPath(exchange); resultHandler(resolvers).handleResult(exchange, result).block(Duration.ofSeconds(5)); assertResponseBody(exchange, responseBody); return exchange;