Remove ServerWebExchange dependency in ServerRequestObservationContext
Avoiding cycle between http.server and web.server packages. See gh-30013
This commit is contained in:
@@ -174,7 +174,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
|
||||
org.springframework.web.filter.reactive.ServerHttpObservationFilter
|
||||
.findObservationContext(serverRequest.exchange())
|
||||
.ifPresent(context -> context.setPathPattern(matchingPattern.toString()));
|
||||
ServerRequestObservationContext.findCurrent(serverRequest.exchange())
|
||||
ServerRequestObservationContext.findCurrent(serverRequest.exchange().getAttributes())
|
||||
.ifPresent(context -> context.setPathPattern(matchingPattern.toString()));
|
||||
}
|
||||
Map<String, String> uriVariables =
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping {
|
||||
org.springframework.web.filter.reactive.ServerHttpObservationFilter
|
||||
.findObservationContext(exchange)
|
||||
.ifPresent(context -> context.setPathPattern(pattern.toString()));
|
||||
ServerRequestObservationContext.findCurrent(exchange)
|
||||
ServerRequestObservationContext.findCurrent(exchange.getAttributes())
|
||||
.ifPresent(context -> context.setPathPattern(pattern.toString()));
|
||||
exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, pathWithinMapping);
|
||||
exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, matchInfo.getUriVariables());
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
org.springframework.web.filter.reactive.ServerHttpObservationFilter
|
||||
.findObservationContext(exchange)
|
||||
.ifPresent(context -> context.setPathPattern(bestPattern.toString()));
|
||||
ServerRequestObservationContext.findCurrent(exchange)
|
||||
ServerRequestObservationContext.findCurrent(exchange.getAttributes())
|
||||
.ifPresent(context -> context.setPathPattern(bestPattern.toString()));
|
||||
exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriVariables);
|
||||
exchange.getAttributes().put(MATRIX_VARIABLES_ATTRIBUTE, matrixVariables);
|
||||
|
||||
@@ -137,7 +137,7 @@ class RouterFunctionMappingTests {
|
||||
assertThat(matchingPattern.getPatternString()).isEqualTo("/match");
|
||||
assertThat(org.springframework.web.filter.reactive.ServerHttpObservationFilter.findObservationContext(exchange))
|
||||
.hasValueSatisfying(context -> assertThat(context.getPathPattern()).isEqualTo(matchingPattern.getPatternString()));
|
||||
assertThat(ServerRequestObservationContext.findCurrent(exchange))
|
||||
assertThat(ServerRequestObservationContext.findCurrent(exchange.getAttributes()))
|
||||
.hasValueSatisfying(context -> assertThat(context.getPathPattern()).isEqualTo(matchingPattern.getPatternString()));
|
||||
|
||||
ServerRequest serverRequest = exchange.getAttribute(RouterFunctions.REQUEST_ATTRIBUTE);
|
||||
|
||||
Reference in New Issue
Block a user