返回

java—如何在spring web flux中使用forward方法

发布时间:2022-08-24 23:32:05 186
# php

我正在尝试将请求从WebFlux重新控制程序转发到不同的内部端点。

@RequestMapping(value = "/connection-success", method = RequestMethod.GET)
public Mono connectionSuccess(@RequestParam("status") String status,
                                          @RequestParam("message") String message) {
        ......
        return Mono.just("forward:/connections");
    }

@RequestMapping(value = "/connections", method = RequestMethod.GET)
public Mono getConnections(Authentication authentication,
                                   Model model,
                                   WebSession webSession) {
       .......
       return Mono.just("customer/connection");
}

但当我呼叫连接成功时,就会出现这种类型的错误

2022-06-20 10:18:05.383 ERROR lettuce-nioEventLoop-4-1 - org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler#error - [de6316a]  500 Server Error for HTTP GET "/customer/connection-success?status=0&message=Connection%20updated%20successfully"
java.lang.IllegalStateException: Could not resolve view with name 'forward:/customer/connections'.
    at org.springframework.web.reactive.result.view.ViewResolutionResultHandler.lambda$resolveViews$3(ViewResolutionResultHandler.java:278) ~[spring-webflux-5.3.14.jar:5.3.14]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
    *__checkpoint ⇢ Handler com.dft.ra.controller.CustomerController#connectionSuccess(String, String) [DispatcherHandler]
    *__checkpoint ⇢ org.springframework.web.filter.reactive.ServerWebExchangeContextFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
    *__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
    *__checkpoint ⇢ HTTP GET "/customer/connection-success?status=0&message=Connection%20updated%20successfully" [ExceptionHandlingWebHandler]
Original Stack Trace:
        at org.springframework.web.reactive.result.view.ViewResolutionResultHandler.lambda$resolveViews$3(ViewResolutionResultHandler.java:278) ~[spring-webflux-5.3.14.jar:5.3.14]
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像