> This works great, but if the exchange is ended-- for example using the
response-code handler-- then the exchange complete listener never fires.
I can't reproduce this issue with response code handler:
import io.undertow.Undertow
import io.undertow.server.handlers.ResponseCodeHandler.HANDLE_403
fun main() {
Undertow.builder().addHttpListener(8080, "0.0.0.0") { exchange ->
exchange.addExchangeCompleteListener { _, nextListener ->
println(">>> Calling listener: [${exchange.requestPath}]")
nextListener.proceed()
}
HANDLE_403.handleRequest(exchange)
}.build().start()
}
It works fine, calling listener
On Mon, Jul 6, 2020, at 19:30, Brad Wood wrote:
Thanks!
~Brad
Developer Advocate
Ortus Solutions, Corp
Well, if the exchange has completed, then it seem quite appropriate to fire the exchange complete listener. Especially if you have logic and/or logging that you want to make sure runs at the end of every request.
I guess that would work as well, it's maybe a bit weird as in this case the proceed() invocation is a noop, but I think that is ok.
Stuart
Why shouldn't it just fire in that case? That would certainly follow the principle of least astonishment.
It should probably throw an exception in this case.
Stuart
I have a basic exchange listener configured for testing that simply logs at the end of each request something like
exchange.addExchangeCompleteListener((httpServerExchange, nextListener) -> {
if (httpServerExchange.getStatusCode() > 399) {
CONTEXT_LOG.warnf("responded: Status Code %s (%s)", httpServerExchange.getStatusCode(), fullExchangePath(httpServerExchange));
}
nextListener.proceed();
});
This works great, but if the exchange is ended-- for example using the response-code handler-- then the exchange complete listener never fires.
Is this working as designed?
Thanks!
~Brad
Developer Advocate
Ortus Solutions, Corp
_______________________________________________
undertow-dev mailing list
_______________________________________________
undertow-dev mailing list
--
Best regards,
Ruslan Ibragimov