I am looking for an example that shows how you write the Response in an undertow HttpHandler asynchronously? The problem is that when HttpServerExchange.endExchange is called the Response is flushed. My sample HttpHandler uses the rx-java library from Scala.
class MyHandler() extends HttpHandler {
override def handleRequest(exchange: HttpServerExchange) = {
val observable = Observable.items(List(1, 2, 3)) // simplistic not long running
observable.map {
// this is run async
myList => exchange.getResponseSender.send(myList.toString)
}
}
}