[undertow-dev] Is there a hook for before sending data to the client?

Bill O'Neil bill at dartalley.com
Sun Nov 20 16:37:49 EST 2016


Exactly what I was looking for thanks!

On Sun, Nov 20, 2016 at 4:23 PM, Stuart Douglas <sdouglas at redhat.com> wrote:

> You can use io.undertow.server.HttpServerExchange#
> addResponseCommitListener
> and implement the ResponseCommitListener interface.
>
> Stuart
>
> On Sun, Nov 20, 2016 at 8:24 AM, Bill O'Neil <bill at dartalley.com> wrote:
> > Hello,
> >
> > I'm trying to make a handler that manages a request scoped sql
> transaction.
> > Ideally it would be a middleware handler that opens the connection and
> > starts the transaction and after the chain of handlers is finished it
> will
> > commit the transaction. The issue I am facing is the browser can receive
> the
> > data before the transaction is committed since the data is sent further
> down
> > the chain.
> >
> > Is there some type of hook where I can commit / close the transaction
> before
> > any data is sent? This should work fine in a blocking handler but an
> > asynchronous one may have issues?
> >
> > My other thought is to make a Handler that expects some object to be
> > returned. In this handler commit / close the connection as soon as the
> > object is returned then send the data to the browser after. Would this
> be my
> > best option?
> >
> > Thanks,
> > Bill
> >
> > _______________________________________________
> > 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/20161120/19a1369e/attachment.html 


More information about the undertow-dev mailing list