[undertow-dev] Tracing HTTP Response content

Stuart Douglas sdouglas at redhat.com
Mon Feb 27 15:16:18 EST 2017


You can use the newish
io.undertow.conduits.StoredResponseStreamSinkConduit, however you will
need to be on a very recent version of Undertow (or you can just copy
the code into your project).

It won't be available in ResponseCommitListener though, as this is
called before any content is written. To be honest I am not really
sure what you are trying to do. In general if you can an IOException
when writing the response there is nothing much you can do other than
terminate the connection.

Stuart

On Tue, Feb 28, 2017 at 12:43 AM, Rohan Emmanuel
<rohan.emmanuel07 at gmail.com> wrote:
> Hi Stuart,
>
> i am new to Undertow code, Can you please elaborate.
>
> yes, The exchange will be passed to the ResponseCommitListener, but From
> exchange i cannot get the response content directly ,correct? as there is no
> method to get the Response body like getResponseHeaders.
>
> so i would need something like  a conduit inside my ResponseCommitListener
> to get a handle on the response content?
> Any other straight forward way to get the response content using exchange
> object?
>
> Thanks for all the help.
>
>
> On Mon, Feb 27, 2017 at 3:50 PM, Stuart Douglas <sdouglas at redhat.com> wrote:
>>
>> You have access to the exchange, it is passed into the
>> ResponseCommitListener.
>>
>> Stuart
>>
>> On Mon, Feb 27, 2017 at 4:25 PM, Rohan Emmanuel
>> <rohan.emmanuel07 at gmail.com> wrote:
>> > hi Stuart,
>> > I have a ResponseCommitListener added to my handler, I want this to
>> > write to
>> > the cache, so that my reponseWrapper will take of the error handling if
>> > the
>> > ResponsecommitListener faces any error while storing the response to
>> > cache.
>> >
>> > I understand HttpResponseConduit constructs the headers and then pushes
>> > the
>> > response.
>> > But the confusion is, how will i get a access to response Headers and
>> > body
>> > in the my ResponseCommitListener?
>> >
>> >
>> > My approach is valid? if not ,any suggestion?
>> >
>> >
>> > On Mon, Feb 27, 2017 at 8:03 AM, Stuart Douglas <sdouglas at redhat.com>
>> > wrote:
>> >>
>> >> Whatever code is writing to the cache needs to just hold onto the
>> >> exchange and send an error response as required.
>> >>
>> >> Stuart
>> >>
>> >> On Fri, Feb 24, 2017 at 5:31 PM, Rohan Emmanuel
>> >> <rohan.emmanuel07 at gmail.com> wrote:
>> >> > Hi,
>> >> > i had a similar query, i want to store the entire response for my
>> >> > book
>> >> > keeping , before it is flush out on to socket connection.
>> >> > if while storing the response(using a cache to store) any IO error
>> >> > occurs ,
>> >> > i want to send out 500 error instead.
>> >> >
>> >> > Any thoughts on how can this be achieved?
>> >> >
>> >> >
>> >> > --
>> >> > Regards,
>> >> > Rohan Emmanuel
>> >> >
>> >> > _______________________________________________
>> >> > undertow-dev mailing list
>> >> > undertow-dev at lists.jboss.org
>> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev
>> >> _______________________________________________
>> >> undertow-dev mailing list
>> >> undertow-dev at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/undertow-dev
>> >
>> >
>> >
>> >
>> > --
>> > Regards,
>> > Rohan Emmanuel
>> _______________________________________________
>> undertow-dev mailing list
>> undertow-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>
>
>
>
> --
> Regards,
> Rohan Emmanuel


More information about the undertow-dev mailing list