dev@grizzly.java.net

Re: comet on glassfish v2 and glassfish v3

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 01 Jul 2008 17:26:34 -0400

Salut,

Cam Bazz wrote:
>
> yes, many people telling me I should blog, so I will.

Great!


>
> I got the comet-count example to work finally. still however not with
> the grizzly-comet jar but with appserv-rt.jar

Right, those examples are for GlassFish v3. I need to backport them and
use the grizzly-compat module....you question inspired me to write a blog:

http://weblogs.java.net/blog/jfarcand/archive/2008/07/porting_and_com.html

>
> also it would be noted to starters that, the jar must be placed under
> glassfish/lib.

Does it work? Meaning you were able to run the example in v2?
Strange....it shouldn't work IMO.


>
> now here is a question:
>
> most examples take advantage of a servlet, and messaging is done within
> the servlet. I have an application, like a game, and I would like to
> show the number of users, and some other numbers to the users. now;
> these numbers might come from database, or an index.
>
> actually what I want to do is run a process each 10 minutes or so, and
> then update the numbers.
>
> how can I push data to servlet in this case?

Just to make sure I understood properly. You want to push data from,
let's say, an EJB or an external component, right? From an external
components, you just need to do:

CometContext ctx = CometEngine.getCometContext("YourContext");
ctx.notify(....)

The CometContext.notify will invoke the CometHandler.onEvent(), which
most probably have a reference to the HttpServletResponse. From that
object, you just need to flush what the external component/ejb have just
pushed.

Does that help?

Thanks

-- Jeanfrancois





>
> Best regards,
> -C.B.
>
>
>
>
> On Tue, Jul 1, 2008 at 10:20 PM, Jeanfrancois Arcand
> <Jeanfrancois.Arcand_at_sun.com <mailto:Jeanfrancois.Arcand_at_sun.com>> wrote:
>
> Salut
>
>
> Cam Bazz wrote:
>
> Hello,
>
> After hours of digging, I somewhat got few comet examples to
> work with netbeans and glassfish v2. It seems that if you add
> appserver-rt.jar to the classpath and use the
> com.sun.enterprise... include, it will work, otherwise you get a
> grizzly not registered exception.
>
>
> Yes I need to document or blog about that. Any chance you can blog
> about your experience?
>
>
>
>
> currently I am checking out the svn of grizzly to review some
> samples.
>
> I understand that some of the samples are glassfish v3. I have
> developed my app in v2, and currently it will be a hassle for me
> to go v3.
>
>
> You don't need to change anything to move from v2 to v3. Just add
> the following bundle under your WEB-INF/lib:
>
> http://download.java.net/maven/2/com/sun/grizzly/grizzly-compat/1.8.0/grizzly-compat-1.8.0.jar
>
> The package name changed between v2 and v3 because Grizzly moved out
> of GlassFish and we renamed the package from
> com.sun.enterprise.web.connector.grizzly to com.sun.grizzly. The
> compat package allow you to run a v2 application in v3 without
> having to change the package name.
>
>
>
> what are the differences between comet in v2 and v3. is comet
> usable for reallife use with v2?
>
>
> The v2 implementation is much more stable and have much more users,
> as Comet was introduced in July 2006 in GlassFish v2. I would
> recommend you stick with v2 for now.
>
> Thanks!
>
> -- Jeanfrancois
>
>
>
> Best Regards,
> -C.B.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
> <mailto:dev-help_at_grizzly.dev.java.net>
>
>