Jonas Bark
10/15/2020, 4:46 PMrunBlocking
"workaround" - thanks @sdeleuze !
Less Kotlin, probably more about Spring itself:
We're also using functional routing for a year now and we're very happy with it. The only thing I miss is support for server side events for Spring MVC projects.
The functional routing receives a ServerRequest
and expects a ServerResponse
in return but I don't see a way to incorporate to respond with the SseEmitter object that is used for SSE on Spring MVC.
Am I missing something or should I open a ticket?sdeleuze
10/16/2020, 7:14 AMsdeleuze
10/16/2020, 7:14 AMJonas Bark
10/16/2020, 7:54 AMJonas Bark
10/16/2020, 2:38 PMsdeleuze
10/16/2020, 3:06 PMcoRouter
would make sense but maybe a ServerResponse.async
extension taking a suspending function as parameter? That would be the Coroutines variant for static ServerResponse async(Object asyncResponse)
.Jonas Bark
10/16/2020, 3:22 PMJonas Bark
10/16/2020, 3:26 PMsdeleuze
10/16/2020, 4:00 PMJonas Bark
10/16/2020, 5:41 PMfun test(request: ServerRequest): ServerResponse {
return ServerResponse.async(mono(Dispatchers.Unconfined) {
throw ResponseStatusException(HttpStatus.BAD_GATEWAY)
})
}
the exception is swallowed, resulting in a HTTP 200 while the logs show
javax.servlet.ServletException: javax.servlet.ServletException: org.springframework.web.server.ResponseStatusException
will I have to invoke Springs internal exception handling system (that renders ResponseStatusException to their HTTP codes) manually?Jonas Bark
10/16/2020, 5:42 PMJonas Bark
10/19/2020, 6:37 AM