dev@grizzly.java.net

Re: a fix for comet-counter example for GlassFish v3?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 03 Apr 2008 10:23:16 -0400

Salut,

Shing-Wai.Chan_at_Sun.COM wrote:
> Hi,
>
> I try the comet-counter example in GlassFish v3 environment.
> I find that I need to update the context-root as follows:
>
> elliptic: /export/grizzly/src/trunk/examples/comet/comet-counter > svn
> diff .
> Index: src/main/webapp/javascripts/counter.js
> ===================================================================
> --- src/main/webapp/javascripts/counter.js (revision 995)
> +++ src/main/webapp/javascripts/counter.js (working copy)
> @@ -1,12 +1,12 @@
> var counter = {
> 'poll' : function() {
> - new Ajax.Request('/demo/long_polling', {
> + new Ajax.Request('/grizzly-comet-counter/long_polling', {
> method : 'GET',
> onSuccess : counter.update
> });
> },
> 'increment' : function() {
> - new Ajax.Request('/demo/long_polling', {
> + new Ajax.Request('/grizzly-comet-counter/long_polling', {
> method : 'POST'
> });
> },
> @@ -25,4 +25,4 @@
> };
>
> Behaviour.register(rules);

Should we instead add some javascript logic to make sure it works for
both Grizzly and Glassfish? Something like:

new
String(document.location).replace(/http:\/\/[^\/]*/,'').replace(/\/\/.*$/,'\/${context-root}')+"/long_polling")

where we dynamically replace ${context-root} with 'context-root' in v3,
and / in Grizzly? Needs help for a Javascript master :-)

A+

-- jeanfrancois


>
>
> Regards,
> Shing Wai Chan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>