users@jersey.java.net

Re: [Jersey] Comet support on Jersey

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 20 May 2009 11:20:31 -0400

Salut,

Etienne Vrignaud wrote:
> Salut,
>
> Thanks for the information.
> I have noticed some commits regarding Jersey on the atmosphere trunk.
> And also I took a look to the new simple-jersey sample.
> I am a little bit in trouble to understand it. I saw the usage of the
> @Suspend annotation, but never the usage of the @Broadcaster one.
> But I can imagine how you intend to manage comet with Jersey.

You looked too fast :-) I will soon fully implement those annotations
but right now it is work in progress. Something ready I would say this
week or early next week. We stabilized the CPR (Comet Portable Runtime)
module and now we started the integration with Jersey.


>
> What I can see is that Atmosphere brings comet support to Jersey using
> Servlets.
> Is it possible to use Atmosphere without any Servlet usage, only using
> Grizzly Adpaters?

Yes, using the AtmosphereGrizzlyAdapter (not yet commited, depend on the
above to be completed). Atmosphere will support Grizzly natively without
the needs to use GlassFish.


>
> In fact, Jersey brings us REST capabilities that are not deeply coupled to
> the Servlet technology.
> My usage of Jersey is directly through the GrizzlyContainer (that is a
> Grizzly Adapter) provided in Jersey.
>
> Could you tell me if there are plans to bring the comet support to Jersey
> without the requirement of Servlet usage?

Yes it will be pretty straightforwards as Jersey already use the
ServletAdapter, which is a tiny wrapper around GrizzlyAdapter. I'm
planning to have an AtmoshereGrizzlyAdapter which will contains all the
information needed to start Atmosphere/Jersey (no configuration needed).
You just drop the AtmospheregrizzlyAdapter via the
GrizzlyWebServer.addGrizzlyAdapter() and that will works.

>
> I have noticed that Glashfish V3 allow to use the Grizzly Adapter directly
> (org.glassfish.api.container.Adapter).
> Can you explain me how you plan to manage comet and REST in that case?

Yes, I've described an example in [1].

The idea will be that in Atmosphere, the atmosphere-core.jar will be
deployable in v3 using that technique. That means you can deploy
Atmosphere without having to start the GlassFish WebContainer, but
instead use the http-servlet module from Grizzly. If I understand
properly your use case, you are using the GrizzlyAdapterChain, in which
you are adding GrizzlyAdapter with their associated mapping. I guess you
will be able to do the same using the AtmosphereAdapter in conjunction
with you own adapter.


A+

-- Jeanfrancois

[1]
http://weblogs.java.net/blog/jfarcand/archive/2009/03/glassfish_v3_ex.html







>
> Thanks!
> /Etienne
>