[undertow-dev] Exchange complete listener doesn't fire if exchange is ended

Brad Wood bdw429s at gmail.com
Sun Jul 5 23:50:55 EDT 2020


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.

On Sun, Jul 5, 2020, 10:43 PM Stuart Douglas <sdouglas at redhat.com> wrote:

> 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
>
> On Mon, 6 Jul 2020 at 13:34, Brad Wood <bdw429s at gmail.com> wrote:
>
>> Why shouldn't it just fire in that case? That would certainly follow the
>> principle of least astonishment.
>>
>> On Sun, Jul 5, 2020, 10:30 PM Stuart Douglas <sdouglas at redhat.com> wrote:
>>
>>> It should probably throw an exception in this case.
>>>
>>> Stuart
>>>
>>> On Sat, 4 Jul 2020 at 09:06, Brad Wood <bdw429s at gmail.com> wrote:
>>>
>>>> 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 *
>>>>
>>>> E-mail: brad at coldbox.org
>>>> ColdBox Platform: http://www.coldbox.org
>>>> Blog: http://www.codersrevolution.com
>>>>
>>>> _______________________________________________
>>>> undertow-dev mailing list
>>>> undertow-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20200705/4223c44c/attachment-0001.html 


More information about the undertow-dev mailing list