users@glassfish.java.net

Re: Push via messaging vs pull via polling..

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 10 Sep 2007 10:13:10 -0400

Salut,

glassfish_at_javadesktop.org wrote:
> Hey Jeanfrancois,
>
> Does this "long polling" technique work with stock, out of the box Glassfish and stock, out of the box Servlets, or is there some configuration and/or special classes that need to be done?

Yes, it works 'out-of-the-box' with Servlet, JSP or event POJO if you
uses Grizzly standalone.

By default the http-listeners aren't 'comet-enabled'. To enable it, you
just need to add the following property under the http-service element:

<property name="cometSupport" value="true"/>

The main reason I didn't enable it by default is their is a very small
performance penalty when doing asynchronous request processing, as you
need to parse the request line to determine if its a comet request or
not. It is probably a very very low impact, but since an extra for
people who aren't using long polling.

>
> Basically, can you just write every day servlets, do you need to code them special, or tell the container something special about them, or can you use servlets at all?

You just need to write a Servlet and then implement the long polling
support by using the Grizzly's Comet API [1]. This is quite simple to
write the server side...for the client side, you will need to know a
little bit of JavaScript/iframe.

Hope that help.

-- Jeanfrancois

[1]
http://weblogs.java.net/blog/jfarcand/archive/2006/10/writting_a_come.html


> [Message sent by forum member 'whartung' (whartung)]
>
> http://forums.java.net/jive/thread.jspa?messageID=234503
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>