I was working on Widlfly10.0.0.Final and Undertow and wanted to know about error handling.
I have added a new custom handler and in that i am doing additional checks(additional book keeping about response).If these checks fail, i wanted to send error response 500.To achieve this, i added a Responecommit listener to my cutom handler and also a DefaultResponseListener.
In the DefaultResponseListener, i understand i can get ResponseSender to send the error message, but this would only be applicable for response without a body. If the response had a body, this sender.send(errorPage) call will fail with BufferOverflow Exception.
In my case , the application servlet is writing response body and my intention is to send the error message instead of the application generated response body.
Any suggestion on how to achieve this?