You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the documentation about Spring WebFlux controller annotated method arguments:
UriComponentsBuilder | For preparing a URL relative to the current request’s host, port, scheme, and path.
When reading this, I understood that the injected builder would include the full path to my controller method, which seemed confirmed by #20546 stating that an injected builder should behave like UriComponentsBuilder.fromHttpRequest(request).
However, when building a war that is deployed to tomcat 9.0.27 under the application context "/context":
Note that I’m fine if the spec changed after #20546 was drafted. The documentation however should be updated.
Interestingly, answers to #21449 state that the injected builder should be "application relative". My understanding of this sentence is that it should include the application context path, but not the controller path. This would have been exactly what I need, but isn’t what I see.
I haven’t tested what happens with non-reactive controllers. Obviously, we want the behavior to match in all three places:
WebFlux
Web MVC
latest documentation.
The text was updated successfully, but these errors were encountered:
EtienneMiret
changed the title
UriComponentsBuilder controller method arguments has no path
UriComponentsBuilder controller method argument has no path
Sep 26, 2020
Thanks for pointing this out. The intent with #21353 was to align with Spring MVC which uses ServletUriComponentsBuilder#fromServletMapping and the docs there do say:
For preparing a URL relative to the current request’s host, port, scheme, context path, and the literal part of the servlet mapping
So to align all 3 I'll make sure the path in WebFlux is application relative.
Affects: Spring WebFlux 5.2.9
From the documentation about Spring WebFlux controller annotated method arguments:
When reading this, I understood that the injected builder would include the full path to my controller method, which seemed confirmed by #20546 stating that an injected builder should behave like
UriComponentsBuilder.fromHttpRequest(request)
.However, when building a war that is deployed to tomcat 9.0.27 under the application context "/context":
Note that I’m fine if the spec changed after #20546 was drafted. The documentation however should be updated.
Interestingly, answers to #21449 state that the injected builder should be "application relative". My understanding of this sentence is that it should include the application context path, but not the controller path. This would have been exactly what I need, but isn’t what I see.
I haven’t tested what happens with non-reactive controllers. Obviously, we want the behavior to match in all three places:
The text was updated successfully, but these errors were encountered: