Spring WebFlux doesn't handle redirect: directives when media type is requested [SPR-15291]
See original GitHub issueGreg Turnquist opened SPR-15291 and commented
The following code…
@Controller
public class WelcomeController {
@GetMapping("/")
@ResponseBody
public String welcome() {
return "Hello World";
}
@GetMapping("/redir")
public Mono<String> redir() {
return Mono.just("redirect:/");
}
}
generates the following stacktrace…
java.lang.IllegalStateException: Could not resolve view with name 'redirect:/'.
at org.springframework.web.reactive.result.view.ViewResolutionResultHandler.lambda$resolveViews$5(ViewResolutionResultHandler.java:274)
Affects: 5.0 M5
Issue Links:
- #19103 Reactive HTTP response based RedirectView
Referenced from: commits https://github.com/spring-projects/spring-framework/commit/226c9f9a73d9468b5c0b1c7dfc35700619e06386, https://github.com/spring-projects/spring-framework/commit/718162b8c428220f4cb9c86092c9c651dec6e71c
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
Redirection inside reactive Spring Webflux REST controller
Redirecting with Controller MVC good-old approach: import org.springframework.http.
Read more >A Guide To Spring Redirects - Baeldung
A guide to redirect and forward in Spring MVC, with a focus on the code and implementation of each strategy.
Read more >Sign users in to your web app using the redirect model | Okta ...
Create the app integration by running: okta apps create web. Copied! · Enter Quickstart when prompted for the app name. · Specify the...
Read more >SVR1: Implementing automatic redirects on the server side ...
When the browser receives this response, the location bar changes and the browser makes a request with the new URL. Examples. Example 1:...
Read more >Redirecting HTTP Requests With Zuul in Spring Boot - DZone
Zuul is part of the Spring Cloud Netflix package and allows redirect REST requests to perform various types of filters.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Brian Clozel commented
Since you may have multiple file types associated with this endpoint, maybe dealing with the response “manually” is the best choice:
Rossen Stoyanchev commented
This looks like a bug. Arguably content negotiation should not impact redirects and I recall this being an issue once for Spring MVC (see #13254) and WebFlux should be consistent.
On the Spring MVC side SmartView extends View. I think in WebFlux we can add isRedirect to View as a default method and then it should be easy for ViewResolutionResultHandler to check if a candidate view is a redirect.