[undertow-dev] undertow http client - howto long polling xhr?

Stuart Douglas sdouglas at redhat.com
Fri Sep 19 19:56:31 EDT 2014


io.undertow.client.ClientExchange#setResponseListener() lets you set a 
callback that will be invoked once the response headers have been parsed.

You then use the io.undertow.client.ClientExchange#getResponseChannel() 
method to read the body. Because this is an XNIO channel it supports 
async IO via the use of a read listener, which gives you a callback when 
more data arrives.

Stuart

Brian Clozel wrote:
> Hi,
>
> I'd like to build an HTTP client that receives chunks of data as part of
> a long polling HTTP request, using Undertow's HTTP client. So in a way,
> I'd need callback methods like "onHeader" and "onContent".
>
>  From what I read in UndertowClient and HttpClientConnection, it looks
> like the http client is parsing the *whole* HTTP response and does not
> provide those callbacks.
>
> Is there a way to achieve this?
> If not, does this qualify as an interesting feature for undertow's HTTP
> client?
>
> Thanks,
> --
> Brian Clozel
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list