users@jersey.java.net

[Jersey] Re: client, couchdb and long polling?

From: Kristian Rink <kawazu428_at_googlemail.com>
Date: Wed, 13 Jun 2012 10:41:30 +0200

Hi Martin;

and thanks a bunch for your thoughts on that.

Am 13.06.2012 10:30, schrieb Martin Matula:
> Well, long polling should be easy - it is basically a regular HTTP
> request that blocks until a change is received. You may want to use
> AsyncWebResource for that. Any particular problem you are facing?

No, none yet. Thanks for pointing me there. So far I have never been in
need to use Jersey/JAX-RS for anything asynchronous so I so far simply
haven't tried. ;)


> For receiving "Continuous Changes" (as defined in the article), it is
> a bit trickier - this is what chunking support in Jersey 2.0 was
> designed for but Jersey 1.x does not provide it out of the box. So,
> you'll have to do a bit more coding on your own. You would have to
> request the entity as InputStream and write a utility class on top of
> that input stream that reads bytes as they become available (plus it
> can use Jackson or some other JSON parser to convert them to POJOs
> and pass to some event handlers).

Imagined something like this already, but wanted to check first whether
there already is a solution at hand for that problem provided by the
framework out of the box. I'll look into both doing it on my own and
seeing whether/how Jersey 2.0 prereleases do about this. :)

Thanks again and all the best,
Kristian