You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/09/02 22:00:38 UTC

svn commit: r691359 [7/8] - in /tomcat/trunk: ./ java/org/apache/cometd/ java/org/apache/cometd/bayeux/ java/org/apache/tomcat/bayeux/ java/org/apache/tomcat/bayeux/request/ test/org/apache/cometd/ test/org/apache/cometd/bayeux/ test/org/apache/cometd/...

Added: tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js?rev=691359&view=auto
==============================================================================
--- tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js (added)
+++ tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js Tue Sep  2 13:00:36 2008
@@ -0,0 +1,20 @@
+/*
+	Copyright (c) 2004-2007, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+/*
+	This is a compiled version of Dojo, built for deployment and not for
+	development. To get an editable version, please visit:
+
+		http://dojotoolkit.org
+
+	for documentation and information on getting the source.
+*/
+
+if(!dojo._hasResource["dojo.AdapterRegistry"]){dojo._hasResource["dojo.AdapterRegistry"]=true;dojo.provide("dojo.AdapterRegistry");dojo.AdapterRegistry=function(_1){this.pairs=[];this.returnWrappers=_1||false;};dojo.extend(dojo.AdapterRegistry,{register:function(_2,_3,_4,_5,_6){this.pairs[((_6)?"unshift":"push")]([_2,_3,_4,_5]);},match:function(){for(var i=0;i<this.pairs.length;i++){var _8=this.pairs[i];if(_8[1].apply(this,arguments)){if((_8[3])||(this.returnWrappers)){return _8[2];}else{return _8[2].apply(this,arguments);}}}throw new Error("No match found");},unregister:function(_9){for(var i=0;i<this.pairs.length;i++){var _b=this.pairs[i];if(_b[0]==_9){this.pairs.splice(i,1);return true;}}return false;}});}if(!dojo._hasResource["dojo.io.script"]){dojo._hasResource["dojo.io.script"]=true;dojo.provide("dojo.io.script");dojo.io.script={get:function(_c){var _d=this._makeScriptDeferred(_c);var _e=_d.ioArgs;dojo._ioAddQueryToUrl(_e);this.attach(_e.id,_e.url);dojo._ioWatch(_d,thi
 s._validCheck,this._ioCheck,this._resHandle);return _d;},attach:function(id,url){var _11=dojo.doc.createElement("script");_11.type="text/javascript";_11.src=url;_11.id=id;dojo.doc.getElementsByTagName("head")[0].appendChild(_11);},remove:function(id){dojo._destroyElement(dojo.byId(id));if(this["jsonp_"+id]){delete this["jsonp_"+id];}},_makeScriptDeferred:function(_13){var dfd=dojo._ioSetArgs(_13,this._deferredCancel,this._deferredOk,this._deferredError);var _15=dfd.ioArgs;_15.id="dojoIoScript"+(this._counter++);_15.canDelete=false;if(_13.callbackParamName){_15.query=_15.query||"";if(_15.query.length>0){_15.query+="&";}_15.query+=_13.callbackParamName+"=dojo.io.script.jsonp_"+_15.id+"._jsonpCallback";_15.canDelete=true;dfd._jsonpCallback=this._jsonpCallback;this["jsonp_"+_15.id]=dfd;}return dfd;},_deferredCancel:function(dfd){dfd.canceled=true;if(dfd.ioArgs.canDelete){dojo.io.script._deadScripts.push(dfd.ioArgs.id);}},_deferredOk:function(dfd){if(dfd.ioArgs.canDelete){dojo.io
 .script._deadScripts.push(dfd.ioArgs.id);}if(dfd.ioArgs.json){return dfd.ioArgs.json;}else{return dfd.ioArgs;}},_deferredError:function(_18,dfd){if(dfd.ioArgs.canDelete){if(_18.dojoType=="timeout"){dojo.io.script.remove(dfd.ioArgs.id);}else{dojo.io.script._deadScripts.push(dfd.ioArgs.id);}}console.debug("dojo.io.script error",_18);return _18;},_deadScripts:[],_counter:1,_validCheck:function(dfd){var _1b=dojo.io.script;var _1c=_1b._deadScripts;if(_1c&&_1c.length>0){for(var i=0;i<_1c.length;i++){_1b.remove(_1c[i]);}dojo.io.script._deadScripts=[];}return true;},_ioCheck:function(dfd){if(dfd.ioArgs.json){return true;}var _1f=dfd.ioArgs.args.checkString;if(_1f&&eval("typeof("+_1f+") != 'undefined'")){return true;}return false;},_resHandle:function(dfd){if(dojo.io.script._ioCheck(dfd)){dfd.callback(dfd);}else{dfd.errback(new Error("inconceivable dojo.io.script._resHandle error"));}},_jsonpCallback:function(_21){this.ioArgs.json=_21;}};}if(!dojo._hasResource["dojox.cometd._base"]){
 dojo._hasResource["dojox.cometd._base"]=true;dojo.provide("dojox.cometd._base");dojox.cometd=new function(){this.DISCONNECTED="DISCONNECTED";this.CONNECTING="CONNECTING";this.CONNECTED="CONNECTED";this.DISCONNECTING="DISCONNECING";this._initialized=false;this._connected=false;this._polling=false;this.connectionTypes=new dojo.AdapterRegistry(true);this.version="1.0";this.minimumVersion="0.9";this.clientId=null;this.messageId=0;this.batch=0;this._isXD=false;this.handshakeReturn=null;this.currentTransport=null;this.url=null;this.lastMessage=null;this._messageQ=[];this.handleAs="json-comment-optional";this._advice={};this._maxInterval=30000;this._backoffInterval=1000;this._deferredSubscribes={};this._deferredUnsubscribes={};this._subscriptions=[];this._extendInList=[];this._extendOutList=[];this.state=function(){return this._initialized?(this._connected?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED);};this.init=function(_22,_23,_24){_23=_2
 3||{};_23.version=this.version;_23.minimumVersion=this.minimumVersion;_23.channel="/meta/handshake";_23.id=""+this.messageId++;this.url=_22||djConfig["cometdRoot"];if(!this.url){console.debug("no cometd root specified in djConfig and no root passed");return null;}var _25="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";var _26=(""+window.location).match(new RegExp(_25));if(_26[4]){var tmp=_26[4].split(":");var _28=tmp[0];var _29=tmp[1]||"80";_26=this.url.match(new RegExp(_25));if(_26[4]){tmp=_26[4].split(":");var _2a=tmp[0];var _2b=tmp[1]||"80";this._isXD=((_2a!=_28)||(_2b!=_29));}}if(!this._isXD){if(_23.ext){if(_23.ext["json-comment-filtered"]!==true&&_23.ext["json-comment-filtered"]!==false){_23.ext["json-comment-filtered"]=true;}}else{_23.ext={"json-comment-filtered":true};}}_23=this._extendOut(_23);var _2c={url:this.url,handleAs:this.handleAs,content:{"message":dojo.toJson([_23])},load:dojo.hitch(this,function(msg){this._finishInit(msg);}),error:dojo.hitch(t
 his,function(e){console.debug("handshake error!:",e);this._finishInit([{}]);})};if(_24){dojo.mixin(_2c,_24);}this._props=_23;for(var _2f in this._subscriptions){for(var sub in this._subscriptions[_2f]){if(this._subscriptions[_2f][sub].topic){dojo.unsubscribe(this._subscriptions[_2f][sub].topic);}}}this._messageQ=[];this._subscriptions=[];this._initialized=true;this.batch=0;this.startBatch();var r;if(this._isXD){_2c.callbackParamName="jsonp";r=dojo.io.script.get(_2c);}else{r=dojo.xhrPost(_2c);}dojo.publish("/cometd/meta",[{cometd:this,action:"handshake",successful:true,state:this.state()}]);return r;};this.publish=function(_32,_33,_34){var _35={data:_33,channel:_32};if(_34){dojo.mixin(_35,_34);}this._sendMessage(_35);};this.subscribe=function(_36,_37,_38){if(_37){var _39="/cometd"+_36;var _3a=this._subscriptions[_39];if(!_3a||_3a.length==0){_3a=[];this._sendMessage({channel:"/meta/subscribe",subscription:_36});var _ds=this._deferredSubscribes;_ds[_36]=new dojo.Deferred();if(_
 ds[_36]){_ds[_36].cancel();delete _ds[_36];}}for(var i in _3a){if(_3a[i].objOrFunc===_37&&(!_3a[i].funcName&&!_38||_3a[i].funcName==_38)){return null;}}var _3d=dojo.subscribe(_39,_37,_38);_3a.push({topic:_3d,objOrFunc:_37,funcName:_38});this._subscriptions[_39]=_3a;}return this._deferredSubscribes[_36];};this.unsubscribe=function(_3e,_3f,_40){var _41="/cometd"+_3e;var _42=this._subscriptions[_41];if(!_42||_42.length==0){return null;}var s=0;for(var i in _42){var sb=_42[i];if((!_3f)||(sb.objOrFunc===_3f&&(!sb.funcName&&!_40||sb.funcName==_40))){dojo.unsubscribe(_42[i].topic);delete _42[i];}else{s++;}}if(s==0){delete this._subscriptions[_41];this._sendMessage({channel:"/meta/unsubscribe",subscription:_3e});this._deferredUnsubscribes[_3e]=new dojo.Deferred();if(this._deferredSubscribes[_3e]){this._deferredSubscribes[_3e].cancel();delete this._deferredSubscribes[_3e];}}return this._deferredUnsubscribes[_3e];};this.disconnect=function(){for(var _46 in this._subscriptions){for(var
  sub in this._subscriptions[_46]){if(this._subscriptions[_46][sub].topic){dojo.unsubscribe(this._subscriptions[_46][sub].topic);}}}this._subscriptions=[];this._messageQ=[];if(this._initialized&&this.currentTransport){this._initialized=false;this.currentTransport.disconnect();}if(!this._polling){this._connected=false;dojo.publish("/cometd/meta",[{cometd:this,action:"connect",successful:false,state:this.state()}]);}this._initialized=false;dojo.publish("/cometd/meta",[{cometd:this,action:"disconnect",successful:true,state:this.state()}]);};this.subscribed=function(_48,_49){};this.unsubscribed=function(_4a,_4b){};this.tunnelInit=function(_4c,_4d){};this.tunnelCollapse=function(){};this._backoff=function(){if(!this._advice||!this._advice.interval){this._advice={reconnect:"retry",interval:0};}if(this._advice.interval<this._maxInterval){this._advice.interval+=this._backoffInterval;}};this._finishInit=function(_4e){_4e=_4e[0];this.handshakeReturn=_4e;if(_4e["advice"]){this._advice=_
 4e.advice;}var _4f=_4e.successful?_4e.successful:false;if(_4e.version<this.minimumVersion){console.debug("cometd protocol version mismatch. We wanted",this.minimumVersion,"but got",_4e.version);_4f=false;this._advice.reconnect="none";}if(_4f){this.currentTransport=this.connectionTypes.match(_4e.supportedConnectionTypes,_4e.version,this._isXD);this.currentTransport._cometd=this;this.currentTransport.version=_4e.version;this.clientId=_4e.clientId;this.tunnelInit=dojo.hitch(this.currentTransport,"tunnelInit");this.tunnelCollapse=dojo.hitch(this.currentTransport,"tunnelCollapse");this.currentTransport.startup(_4e);}dojo.publish("/cometd/meta",[{cometd:this,action:"handshook",successful:_4f,state:this.state()}]);if(!_4f){console.debug("cometd init failed");this._backoff();if(this._advice&&this._advice["reconnect"]=="none"){console.debug("cometd reconnect: none");}else{if(this._advice&&this._advice["interval"]&&this._advice.interval>0){setTimeout(dojo.hitch(this,function(){this.in
 it(cometd.url,this._props);}),this._advice.interval);}else{this.init(this.url,this._props);}}}};this._extendIn=function(_50){var m=_50;dojo.forEach(dojox.cometd._extendInList,function(f){var n=f(m);if(n){m=n;}});return m;};this._extendOut=function(_54){var m=_54;dojo.forEach(dojox.cometd._extendOutList,function(f){var n=f(m);if(n){m=n;}});return m;};this.deliver=function(_58){dojo.forEach(_58,this._deliver,this);return _58;};this._deliver=function(_59){_59=this._extendIn(_59);if(!_59["channel"]){if(_59["success"]!==true){console.debug("cometd error: no channel for message!",_59);return;}}this.lastMessage=_59;if(_59.advice){this._advice=_59.advice;}var _5a=null;if((_59["channel"])&&(_59.channel.length>5)&&(_59.channel.substr(0,5)=="/meta")){switch(_59.channel){case "/meta/connect":if(_59.successful&&!this._connected){this._connected=this._initialized;this.endBatch();}else{if(!this._initialized){this._connected=false;}}dojo.publish("/cometd/meta",[{cometd:this,action:"connect"
 ,successful:_59.successful,state:this.state()}]);break;case "/meta/subscribe":_5a=this._deferredSubscribes[_59.subscription];if(!_59.successful){if(_5a){_5a.errback(new Error(_59.error));}return;}dojox.cometd.subscribed(_59.subscription,_59);if(_5a){_5a.callback(true);}break;case "/meta/unsubscribe":_5a=this._deferredUnsubscribes[_59.subscription];if(!_59.successful){if(_5a){_5a.errback(new Error(_59.error));}return;}this.unsubscribed(_59.subscription,_59);if(_5a){_5a.callback(true);}break;}}this.currentTransport.deliver(_59);if(_59.data){try{var _5b="/cometd"+_59.channel;dojo.publish(_5b,[_59]);}catch(e){console.debug(e);}}};this._sendMessage=function(_5c){if(this.currentTransport&&this._connected&&this.batch==0){return this.currentTransport.sendMessages([_5c]);}else{this._messageQ.push(_5c);return null;}};this.startBatch=function(){this.batch++;};this.endBatch=function(){if(--this.batch<=0&&this.currentTransport&&this._connected){this.batch=0;var _5d=this._messageQ;this._m
 essageQ=[];if(_5d.length>0){this.currentTransport.sendMessages(_5d);}}};this._onUnload=function(){dojo.addOnUnload(dojox.cometd,"disconnect");};};dojox.cometd.longPollTransport=new function(){this._connectionType="long-polling";this._cometd=null;this.check=function(_5e,_5f,_60){return ((!_60)&&(dojo.indexOf(_5e,"long-polling")>=0));};this.tunnelInit=function(){var _61={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};_61=this._cometd._extendOut(_61);this.openTunnelWith({message:dojo.toJson([_61])});};this.tunnelCollapse=function(){if(!this._cometd._initialized){return;}if(this._cometd._advice){if(this._cometd._advice["reconnect"]=="none"){return;}if((this._cometd._advice["interval"])&&(this._cometd._advice.interval>0)){setTimeout(dojo.hitch(this,function(){this._connect();}),this._cometd._advice.interval);}else{this._connect();}}else{this._connect();}};this._connect=function(){if(!this._cometd._initial
 ized){return;}if(this._cometd._polling){console.debug("wait for poll to complete or fail");return;}if((this._cometd._advice)&&(this._cometd._advice["reconnect"]=="handshake")){this._cometd._connected=false;this._initialized=false;this._cometd.init(this._cometd.url,this._cometd._props);}else{if(this._cometd._connected){var _62={channel:"/meta/connect",connectionType:this._connectionType,clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_62=this._cometd._extendOut(_62);this.openTunnelWith({message:dojo.toJson([_62])});}}};this.deliver=function(_63){};this.openTunnelWith=function(_64,url){this._cometd._polling=true;var d=dojo.xhrPost({url:(url||this._cometd.url),content:_64,handleAs:this._cometd.handleAs,load:dojo.hitch(this,function(_67){this._cometd._polling=false;this._cometd.deliver(_67);this.tunnelCollapse();}),error:dojo.hitch(this,function(err){this._cometd._polling=false;console.debug("tunnel opening failed:",err);dojo.publish("/cometd/meta",[{cometd:this._
 cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse();})});};this.sendMessages=function(_69){for(var i=0;i<_69.length;i++){_69[i].clientId=this._cometd.clientId;_69[i].id=""+this._cometd.messageId++;_69[i]=this._cometd._extendOut(_69[i]);}return dojo.xhrPost({url:this._cometd.url||djConfig["cometdRoot"],handleAs:this._cometd.handleAs,load:dojo.hitch(this._cometd,"deliver"),content:{message:dojo.toJson(_69)}});};this.startup=function(_6b){if(this._cometd._connected){return;}this.tunnelInit();};this.disconnect=function(){var _6c={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_6c=this._cometd._extendOut(_6c);dojo.xhrPost({url:this._cometd.url||djConfig["cometdRoot"],handleAs:this._cometd.handleAs,content:{message:dojo.toJson([_6c])}});};};dojox.cometd.callbackPollTransport=new function(){this._connectionType="callback-polling";this._cometd=null;this.check=function(_6d,_6e,
 _6f){return (dojo.indexOf(_6d,"callback-polling")>=0);};this.tunnelInit=function(){var _70={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};_70=this._cometd._extendOut(_70);this.openTunnelWith({message:dojo.toJson([_70])});};this.tunnelCollapse=dojox.cometd.longPollTransport.tunnelCollapse;this._connect=dojox.cometd.longPollTransport._connect;this.deliver=dojox.cometd.longPollTransport.deliver;this.openTunnelWith=function(_71,url){this._cometd._polling=true;dojo.io.script.get({load:dojo.hitch(this,function(_73){this._cometd._polling=false;this._cometd.deliver(_73);this.tunnelCollapse();}),error:dojo.hitch(this,function(err){this._cometd._polling=false;console.debug("tunnel opening failed:",err);dojo.publish("/cometd/meta",[{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse();}),url:(url||this._cometd.url),content:_71,callbac
 kParamName:"jsonp"});};this.sendMessages=function(_75){for(var i=0;i<_75.length;i++){_75[i].clientId=this._cometd.clientId;_75[i].id=""+this._cometd.messageId++;_75[i]=this._cometd._extendOut(_75[i]);}var _77={url:this._cometd.url||djConfig["cometdRoot"],load:dojo.hitch(this._cometd,"deliver"),callbackParamName:"jsonp",content:{message:dojo.toJson(_75)}};return dojo.io.script.get(_77);};this.startup=function(_78){if(this._cometd._connected){return;}this.tunnelInit();};this.disconnect=dojox.cometd.longPollTransport.disconnect;this.disconnect=function(){var _79={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_79=this._cometd._extendOut(_79);dojo.io.script.get({url:this._cometd.url||djConfig["cometdRoot"],callbackParamName:"jsonp",content:{message:dojo.toJson([_79])}});};};dojox.cometd.connectionTypes.register("long-polling",dojox.cometd.longPollTransport.check,dojox.cometd.longPollTransport);dojox.cometd.connectionTypes.register("call
 back-polling",dojox.cometd.callbackPollTransport.check,dojox.cometd.callbackPollTransport);dojo.addOnUnload(dojox.cometd,"_onUnload");}if(!dojo._hasResource["dojox.cometd"]){dojo._hasResource["dojox.cometd"]=true;dojo.provide("dojox.cometd");}

Added: tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js.uncompressed.js
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js.uncompressed.js?rev=691359&view=auto
==============================================================================
--- tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js.uncompressed.js (added)
+++ tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.js.uncompressed.js Tue Sep  2 13:00:36 2008
@@ -0,0 +1,1142 @@
+/*
+	Copyright (c) 2004-2007, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+/*
+	This is a compiled version of Dojo, built for deployment and not for
+	development. To get an editable version, please visit:
+
+		http://dojotoolkit.org
+
+	for documentation and information on getting the source.
+*/
+
+if(!dojo._hasResource["dojo.AdapterRegistry"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.AdapterRegistry"] = true;
+dojo.provide("dojo.AdapterRegistry");
+
+dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
+	//	summary:
+	//		A registry to make contextual calling/searching easier.
+	//	description:
+	//		Objects of this class keep list of arrays in the form [name, check,
+	//		wrap, directReturn] that are used to determine what the contextual
+	//		result of a set of checked arguments is. All check/wrap functions
+	//		in this registry should be of the same arity.
+	//	example:
+	//	|	// create a new registry
+	//	|	var reg = new dojo.AdapterRegistry();
+	//	|	reg.register("handleString",
+	//	|		dojo.isString,
+	//	|		function(str){
+	//	|			// do something with the string here
+	//	|		}
+	//	|	);
+	//	|	reg.register("handleArr",
+	//	|		dojo.isArray,
+	//	|		function(arr){
+	//	|			// do something with the array here
+	//	|		}
+	//	|	);
+	//	|
+	//	|	// now we can pass reg.match() *either* an array or a string and
+	//	|	// the value we pass will get handled by the right function
+	//	|	reg.match("someValue"); // will call the first function
+	//	|	reg.match(["someValue"]); // will call the second
+
+	this.pairs = [];
+	this.returnWrappers = returnWrappers || false; // Boolean
+}
+
+dojo.extend(dojo.AdapterRegistry, {
+	register: function(/*String*/ name, /*Function*/ check, /*Function*/ wrap, /*Boolean?*/ directReturn, /*Boolean?*/ override){
+		//	summary: 
+		//		register a check function to determine if the wrap function or
+		//		object gets selected
+		//	name:
+		//		a way to identify this matcher.
+		//	check:
+		//		a function that arguments are passed to from the adapter's
+		//		match() function.  The check function should return true if the
+		//		given arguments are appropriate for the wrap function.
+		//	directReturn:
+		//		If directReturn is true, the value passed in for wrap will be
+		//		returned instead of being called. Alternately, the
+		//		AdapterRegistry can be set globally to "return not call" using
+		//		the returnWrappers property. Either way, this behavior allows
+		//		the registry to act as a "search" function instead of a
+		//		function interception library.
+		//	override:
+		//		If override is given and true, the check function will be given
+		//		highest priority. Otherwise, it will be the lowest priority
+		//		adapter.
+		this.pairs[((override) ? "unshift" : "push")]([name, check, wrap, directReturn]);
+	},
+
+	match: function(/* ... */){
+		// summary:
+		//		Find an adapter for the given arguments. If no suitable adapter
+		//		is found, throws an exception. match() accepts any number of
+		//		arguments, all of which are passed to all matching functions
+		//		from the registered pairs.
+		for(var i = 0; i < this.pairs.length; i++){
+			var pair = this.pairs[i];
+			if(pair[1].apply(this, arguments)){
+				if((pair[3])||(this.returnWrappers)){
+					return pair[2];
+				}else{
+					return pair[2].apply(this, arguments);
+				}
+			}
+		}
+		throw new Error("No match found");
+	},
+
+	unregister: function(name){
+		// summary: Remove a named adapter from the registry
+
+		// FIXME: this is kind of a dumb way to handle this. On a large
+		// registry this will be slow-ish and we can use the name as a lookup
+		// should we choose to trade memory for speed.
+		for(var i = 0; i < this.pairs.length; i++){
+			var pair = this.pairs[i];
+			if(pair[0] == name){
+				this.pairs.splice(i, 1);
+				return true;
+			}
+		}
+		return false;
+	}
+});
+
+}
+
+if(!dojo._hasResource["dojo.io.script"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojo.io.script"] = true;
+dojo.provide("dojo.io.script");
+
+/*=====
+dojo.io.script.__ioArgs = function(kwArgs){
+	//	summary:
+	//		All the properties described in the dojo.__ioArgs type, apply to this
+	//		type as well, EXCEPT "handleAs". It is not applicable to
+	//		dojo.io.script.get() calls, since it is implied by the usage of
+	//		"callbackParamName" (response will be a JSONP call returning JSON)
+	//		or "checkString" (response is pure JavaScript defined in
+	//		the body of the script that was attached). The following additional
+	//		properties are allowed for dojo.io.script.get():
+	//	callbackParamName: String
+	//		The URL parameter name that indicates the JSONP callback string.
+	//		For instance, when using Yahoo JSONP calls it is normally, 
+	//		callbackParamName: "callback". For AOL JSONP calls it is normally 
+	//		callbackParamName: "c".
+	//	checkString: String
+	//		A string of JavaScript that when evaluated like so: 
+	//		"typeof(" + checkString + ") != 'undefined'"
+	//		being true means that the script fetched has been loaded. 
+	//		Do not use this if doing a JSONP type of call (use callbackParamName instead).
+}
+=====*/
+
+dojo.io.script = {
+	get: function(/*dojo.io.script.__ioArgs*/args){
+		//	summary:
+		//		sends a get request using a dynamically created script tag.
+		var dfd = this._makeScriptDeferred(args);
+		var ioArgs = dfd.ioArgs;
+		dojo._ioAddQueryToUrl(ioArgs);
+
+		this.attach(ioArgs.id, ioArgs.url);
+		dojo._ioWatch(dfd, this._validCheck, this._ioCheck, this._resHandle);
+		return dfd;
+	},
+
+	attach: function(/*String*/id, /*String*/url){
+		//	summary:
+		//		creates a new <script> tag pointing to the specified URL and
+		//		adds it to the document.
+		//	description:
+		//		Attaches the script element to the DOM.  Use this method if you
+		//		just want to attach a script to the DOM and do not care when or
+		//		if it loads.
+		var element = dojo.doc.createElement("script");
+		element.type = "text/javascript";
+		element.src = url;
+		element.id = id;
+		dojo.doc.getElementsByTagName("head")[0].appendChild(element);
+	},
+
+	remove: function(/*String*/id){
+		//summary: removes the script element with the given id.
+		dojo._destroyElement(dojo.byId(id));
+		
+		//Remove the jsonp callback on dojo.io.script, if it exists.
+		if(this["jsonp_" + id]){
+			delete this["jsonp_" + id];
+		}
+	},
+
+	_makeScriptDeferred: function(/*Object*/args){
+		//summary: 
+		//		sets up a Deferred object for an IO request.
+		var dfd = dojo._ioSetArgs(args, this._deferredCancel, this._deferredOk, this._deferredError);
+
+		var ioArgs = dfd.ioArgs;
+		ioArgs.id = "dojoIoScript" + (this._counter++);
+		ioArgs.canDelete = false;
+
+		//Special setup for jsonp case
+		if(args.callbackParamName){
+			//Add the jsonp parameter.
+			ioArgs.query = ioArgs.query || "";
+			if(ioArgs.query.length > 0){
+				ioArgs.query += "&";
+			}
+			ioArgs.query += args.callbackParamName + "=dojo.io.script.jsonp_" + ioArgs.id + "._jsonpCallback";
+
+			//Setup the Deferred to have the jsonp callback.
+			ioArgs.canDelete = true;
+			dfd._jsonpCallback = this._jsonpCallback;
+			this["jsonp_" + ioArgs.id] = dfd;
+		}
+		return dfd; // dojo.Deferred
+	},
+	
+	_deferredCancel: function(/*Deferred*/dfd){
+		//summary: canceller function for dojo._ioSetArgs call.
+
+		//DO NOT use "this" and expect it to be dojo.io.script.
+		dfd.canceled = true;
+		if(dfd.ioArgs.canDelete){
+			dojo.io.script._deadScripts.push(dfd.ioArgs.id);
+		}
+	},
+
+	_deferredOk: function(/*Deferred*/dfd){
+		//summary: okHandler function for dojo._ioSetArgs call.
+
+		//DO NOT use "this" and expect it to be dojo.io.script.
+
+		//Add script to list of things that can be removed.		
+		if(dfd.ioArgs.canDelete){
+			dojo.io.script._deadScripts.push(dfd.ioArgs.id);
+		}
+
+		if(dfd.ioArgs.json){
+			//Make sure to *not* remove the json property from the
+			//Deferred, so that the Deferred can still function correctly
+			//after the response is received.
+			return dfd.ioArgs.json;
+		}else{
+			//FIXME: cannot return the dfd here, otherwise that stops
+			//the callback chain in Deferred. So return the ioArgs instead.
+			//This doesn't feel right.
+			return dfd.ioArgs;
+		}
+	},
+	
+	_deferredError: function(/*Error*/error, /*Deferred*/dfd){
+		//summary: errHandler function for dojo._ioSetArgs call.
+
+		if(dfd.ioArgs.canDelete){
+			//DO NOT use "this" and expect it to be dojo.io.script.
+			if(error.dojoType == "timeout"){
+				//For timeouts, remove the script element immediately to
+				//avoid a response from it coming back later and causing trouble.
+				dojo.io.script.remove(dfd.ioArgs.id);
+			}else{
+				dojo.io.script._deadScripts.push(dfd.ioArgs.id);
+			}
+		}
+		console.debug("dojo.io.script error", error);
+		return error;
+	},
+
+	_deadScripts: [],
+	_counter: 1,
+
+	_validCheck: function(/*Deferred*/dfd){
+		//summary: inflight check function to see if dfd is still valid.
+
+		//Do script cleanup here. We wait for one inflight pass
+		//to make sure we don't get any weird things by trying to remove a script
+		//tag that is part of the call chain (IE 6 has been known to
+		//crash in that case).
+		var _self = dojo.io.script;
+		var deadScripts = _self._deadScripts;
+		if(deadScripts && deadScripts.length > 0){
+			for(var i = 0; i < deadScripts.length; i++){
+				//Remove the script tag
+				_self.remove(deadScripts[i]);
+			}
+			dojo.io.script._deadScripts = [];
+		}
+
+		return true;
+	},
+
+	_ioCheck: function(/*Deferred*/dfd){
+		//summary: inflight check function to see if IO finished.
+
+		//Check for finished jsonp
+		if(dfd.ioArgs.json){
+			return true;
+		}
+
+		//Check for finished "checkString" case.
+		var checkString = dfd.ioArgs.args.checkString;
+		if(checkString && eval("typeof(" + checkString + ") != 'undefined'")){
+			return true;
+		}
+
+		return false;
+	},
+
+	_resHandle: function(/*Deferred*/dfd){
+		//summary: inflight function to handle a completed response.
+		if(dojo.io.script._ioCheck(dfd)){
+			dfd.callback(dfd);
+		}else{
+			//This path should never happen since the only way we can get
+			//to _resHandle is if _ioCheck is true.
+			dfd.errback(new Error("inconceivable dojo.io.script._resHandle error"));
+		}
+	},
+
+	_jsonpCallback: function(/*JSON Object*/json){
+		//summary: 
+		//		generic handler for jsonp callback. A pointer to this function
+		//		is used for all jsonp callbacks.  NOTE: the "this" in this
+		//		function will be the Deferred object that represents the script
+		//		request.
+		this.ioArgs.json = json;
+	}
+}
+
+}
+
+if(!dojo._hasResource["dojox.cometd._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.cometd._base"] = true;
+dojo.provide("dojox.cometd._base");
+
+
+
+
+/*
+ * this file defines Comet protocol client. Actual message transport is
+ * deferred to one of several connection type implementations. The default is a
+ * long-polling implementation. A single global object named "dojox.cometd" is
+ * used to mediate for these connection types in order to provide a stable
+ * interface.
+ *
+ * extensions modules may be loaded (eg "dojox.cometd.timestamp", that use
+ * the cometd._extendInList and cometd._extendOutList fields to provide functions
+ * that extend and handling incoming and outgoing messages.
+ */
+
+dojox.cometd = new function(){
+	
+	// cometd states:
+ 	this.DISCONNECTED="DISCONNECTED";	// _initialized==false 	&& _connected==false
+ 	this.CONNECTING="CONNECTING";		// _initialized==true	&& _connected==false (handshake sent)
+ 	this.CONNECTED="CONNECTED";		// _initialized==true	&& _connected==true (first successful connect)
+ 	this.DISCONNECTING="DISCONNECING";	// _initialized==false 	&& _connected==true (disconnect sent)
+ 	
+	this._initialized = false;
+	this._connected = false;
+	this._polling = false;
+
+	this.connectionTypes = new dojo.AdapterRegistry(true);
+
+	this.version="1.0";
+	this.minimumVersion="0.9";
+	this.clientId=null;
+	this.messageId=0;
+	this.batch=0;
+
+	this._isXD = false;
+	this.handshakeReturn=null;
+	this.currentTransport=null;
+	this.url = null;
+	this.lastMessage=null;
+	this._messageQ=[];
+	this.handleAs="json-comment-optional";
+	this._advice={};
+	this._maxInterval=30000;
+	this._backoffInterval=1000;
+	this._deferredSubscribes={};
+	this._deferredUnsubscribes={};
+	this._subscriptions=[];
+	this._extendInList=[];	// List of functions invoked before delivering messages
+	this._extendOutList=[];	// List of functions invoked before sending messages
+
+	this.state = function() {
+		return this._initialized?(this._connected?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED);
+	}
+
+	this.init = function(	/*String*/	root,
+				/*Object|null */ props,
+				/*Object|null */ bargs){	// return: dojo.Deferred
+		//	summary:
+		//		Initialize the cometd implementation of the Bayeux protocol
+		//	description:
+		//		Initialize the cometd implementation of the Bayeux protocol by
+		//		sending a handshake message. The cometd state will be changed to CONNECTING
+		//		until a handshake response is received and the first successful connect message
+		//		has returned.
+		//		The protocol state changes may be monitored
+		//		by subscribing to the dojo topic "/cometd/meta" where events are
+		//		published in the form {cometd:this,action:"handshake",successful:true,state:this.state()}
+		//	root:
+		//		The URL of the cometd server. If the root is absolute, the host
+		//		is examined to determine if xd transport is needed. Otherwise the
+		//		same domain is assumed.
+		//	props:
+		//		An optional object that is used as the basis of the handshake message
+		//	bargs:
+		//		An optional object of bind args mixed in with the send of the handshake
+		//	example:
+		//	|	dojox.cometd.init("/cometd");
+		//	|	dojox.cometd.init("http://xdHost/cometd",{ext:{user:"fred",pwd:"secret"}});
+
+
+		// FIXME: if the root isn't from the same host, we should automatically
+		// try to select an XD-capable transport
+		props = props||{};
+		// go ask the short bus server what we can support
+		props.version = this.version;
+		props.minimumVersion = this.minimumVersion;
+		props.channel = "/meta/handshake";
+		props.id = ""+this.messageId++;
+
+		this.url = root||djConfig["cometdRoot"];
+		if(!this.url){
+			console.debug("no cometd root specified in djConfig and no root passed");
+			return null;
+		}
+
+		// Are we x-domain? borrowed from dojo.uri.Uri in lieu of fixed host and port properties
+		var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";
+		var parts = (""+window.location).match(new RegExp(regexp));
+		if(parts[4]){
+			var tmp = parts[4].split(":");
+			var thisHost = tmp[0];
+			var thisPort = tmp[1]||"80"; // FIXME: match 443
+
+			parts = this.url.match(new RegExp(regexp));
+			if(parts[4]){
+				tmp = parts[4].split(":");
+				var urlHost = tmp[0];
+				var urlPort = tmp[1]||"80";
+				this._isXD = ((urlHost != thisHost)||(urlPort != thisPort));
+			}
+		}
+
+		if(!this._isXD){
+			if(props.ext){
+				if(props.ext["json-comment-filtered"]!==true && props.ext["json-comment-filtered"]!==false){
+					props.ext["json-comment-filtered"] = true;
+				}
+			}else{
+				props.ext = { "json-comment-filtered": true };
+			}
+		}
+
+		props=this._extendOut(props);
+
+		var bindArgs = {
+			url: this.url,
+			handleAs: this.handleAs,
+			content: { "message": dojo.toJson([props]) },
+			load: dojo.hitch(this,function(msg){
+				this._finishInit(msg);
+			}),
+			error: dojo.hitch(this,function(e){
+				console.debug("handshake error!:",e);
+				this._finishInit([{}]);
+			})
+		};
+
+		if(bargs){
+			dojo.mixin(bindArgs, bargs);
+		}
+		this._props=props;
+		for(var tname in this._subscriptions){
+			for(var sub in this._subscriptions[tname]){
+				if(this._subscriptions[tname][sub].topic){
+		 			dojo.unsubscribe(this._subscriptions[tname][sub].topic);
+				}
+			}
+		}
+		this._messageQ = [];
+		this._subscriptions = [];
+		this._initialized=true;
+		this.batch=0;
+		this.startBatch();
+		
+		var r;
+		// if xdomain, then we assume jsonp for handshake
+		if(this._isXD){
+			bindArgs.callbackParamName="jsonp";
+			r= dojo.io.script.get(bindArgs);
+		} else
+			r = dojo.xhrPost(bindArgs);
+		dojo.publish("/cometd/meta", [{cometd:this,action:"handshake",successful:true,state:this.state()}]);
+		return r;
+	}
+	
+	
+	this.publish = function(/*String*/channel, /*Object */data, /*Object|null */properties){
+		// summary:
+		//		publishes the passed message to the cometd server for delivery
+		//		on the specified topic
+		// channel:
+		//		the destination channel for the message
+		// data:
+		//		a JSON object containing the message "payload"
+		// properties:
+		//		Optional. Other meta-data to be mixed into the top-level of the
+		//		message
+		var message = {
+			data: data,
+			channel: channel
+		};
+		if(properties){
+			dojo.mixin(message, properties);
+		}
+		this._sendMessage(message);
+	}
+
+	
+	this.subscribe = function(	/*String */	channel,
+					/*Object */	objOrFunc,
+					/*String */	funcName){ // return: dojo.Deferred
+		// summary:
+		//		inform the server of this client's interest in channel
+		// channel:
+		//		name of the cometd channel to subscribe to
+		// objOrFunc:
+		//		an object scope for funcName or the name or reference to a
+		//		function to be called when messages are delivered to the
+		//		channel
+		// funcName:
+		//		the second half of the objOrFunc/funcName pair for identifying
+		//		a callback function to notifiy upon channel message delivery
+
+		if(objOrFunc){
+			var tname = "/cometd"+channel;
+			var subs=this._subscriptions[tname];
+			if(!subs || subs.length==0){
+				subs=[];
+				this._sendMessage({
+					channel: "/meta/subscribe",
+					subscription: channel
+				});
+				
+				var _ds = this._deferredSubscribes;
+				_ds[channel] = new dojo.Deferred();
+				if(_ds[channel]){
+					_ds[channel].cancel();
+					delete _ds[channel];
+				}
+			}
+			
+			for (var i in subs){
+				if (subs[i].objOrFunc===objOrFunc&&(!subs[i].funcName&&!funcName||subs[i].funcName==funcName))
+					return null;
+			}
+			
+			var topic = dojo.subscribe(tname, objOrFunc, funcName);
+			subs.push({ 
+				topic: topic, 
+				objOrFunc: objOrFunc, 
+				funcName: funcName
+			});
+			this._subscriptions[tname] =subs;
+		}
+		return this._deferredSubscribes[channel];
+	}
+
+
+
+	this.unsubscribe = function(	/*string*/	channel,
+					/*object|null*/ objOrFunc,
+					/*string|null*/ funcName){
+		// summary:
+		//		inform the server of this client's disinterest in channel
+		// channel:
+		//		name of the cometd channel to unsubscribe from
+		// objOrFunc:
+		//		an object scope for funcName or the name or reference to a
+		//		function to be called when messages are delivered to the
+		//		channel. If null then all subscribers to the channel are unsubscribed.
+		// funcName:
+		//		the second half of the objOrFunc/funcName pair for identifying
+		//		a callback function to notifiy upon channel message delivery
+		
+		var tname = "/cometd"+channel;
+		var subs=this._subscriptions[tname];
+		if(!subs || subs.length==0){
+			return null;
+		}
+
+		var s=0;
+		for(var i in subs){
+			var sb=subs[i];
+			if( (!objOrFunc) ||
+				(
+					sb.objOrFunc===objOrFunc &&
+					(!sb.funcName && !funcName || sb.funcName==funcName)
+				)
+			){
+				dojo.unsubscribe(subs[i].topic);
+				delete subs[i];
+			}else{
+				s++;
+			}
+		}
+		
+		if(s==0){
+			delete this._subscriptions[tname];
+			this._sendMessage({
+				channel: "/meta/unsubscribe",
+				subscription: channel
+			});
+			this._deferredUnsubscribes[channel] = new dojo.Deferred();
+			if (this._deferredSubscribes[channel]){
+				this._deferredSubscribes[channel].cancel();
+				delete this._deferredSubscribes[channel];
+			}
+		}
+		return this._deferredUnsubscribes[channel];
+	}
+	
+	
+	this.disconnect = function(){
+		//	summary:
+		//		Disconnect from the server.
+		//	description:
+		//		Disconnect from the server by sending a disconnect message
+		//	example:
+		//	|	dojox.cometd.disconnect();
+
+		for(var tname in this._subscriptions){
+			for(var sub in this._subscriptions[tname]){
+				if(this._subscriptions[tname][sub].topic){
+					dojo.unsubscribe(this._subscriptions[tname][sub].topic);
+				}
+			}
+		}
+		this._subscriptions = [];
+		this._messageQ = [];
+		if(this._initialized && this.currentTransport){
+			this._initialized=false;
+			this.currentTransport.disconnect();
+		}
+		if(!this._polling) {
+			this._connected=false;
+			dojo.publish("/cometd/meta", [{cometd:this,action:"connect",successful:false,state:this.state()}]);
+		}
+		this._initialized=false;
+		dojo.publish("/cometd/meta", [{cometd:this,action:"disconnect",successful:true,state:this.state()}]);
+	}
+
+	
+	// public extension points
+	
+	this.subscribed = function(	/*String*/channel, /*Object*/message){ }
+
+	this.unsubscribed = function(/*String*/channel, /*Object*/message){ }
+
+
+	// private methods (TODO name all with leading _)
+
+	this.tunnelInit = function(childLocation, childDomain){
+		// placeholder - replaced by _finishInit
+	}
+	
+	this.tunnelCollapse = function(){
+		// placeholder - replaced by _finishInit
+	}
+	
+	this._backoff = function(){
+		if(!this._advice || !this._advice.interval){
+			this._advice={reconnect:"retry",interval:0}; // TODO Is this good advice?
+		}
+		if(this._advice.interval<this._maxInterval){
+			this._advice.interval+=this._backoffInterval;
+		}
+	}
+
+	this._finishInit = function(data){
+		//	summary:
+		//		Handle the handshake return from the server and initialize
+		//		connection if all is OK
+		data = data[0];
+		this.handshakeReturn = data;
+		
+		// remember any advice
+		if(data["advice"]){
+			this._advice = data.advice;
+		}
+
+		var successful=data.successful?data.successful:false;
+		
+		// check version
+		if(data.version < this.minimumVersion){
+			console.debug("cometd protocol version mismatch. We wanted", this.minimumVersion, "but got", data.version);
+			successful=false;
+			this._advice.reconnect="none";
+		}
+		
+		// If all OK
+		if(successful){
+			// pick a transport
+			this.currentTransport = this.connectionTypes.match(
+				data.supportedConnectionTypes,
+				data.version,
+				this._isXD
+			);
+			// initialize the transport
+			this.currentTransport._cometd = this;
+			this.currentTransport.version = data.version;
+			this.clientId = data.clientId;
+			this.tunnelInit = dojo.hitch(this.currentTransport, "tunnelInit");
+			this.tunnelCollapse = dojo.hitch(this.currentTransport, "tunnelCollapse");
+			this.currentTransport.startup(data);
+		}
+
+		dojo.publish("/cometd/meta", [{cometd:this,action:"handshook",successful:successful,state:this.state()}]);
+
+		// If there is a problem
+		if(!successful){
+			console.debug("cometd init failed");
+			this._backoff();
+			// follow advice
+			if(this._advice && this._advice["reconnect"]=="none"){
+				console.debug("cometd reconnect: none");
+			}else if(this._advice && this._advice["interval"] && this._advice.interval>0 ){
+				setTimeout(
+					dojo.hitch(this, function(){ this.init(cometd.url,this._props); }),
+					this._advice.interval
+				);
+			}else{
+				this.init(this.url,this._props);
+			}
+		}
+	}
+
+	this._extendIn = function(message){
+		// Handle extensions for inbound messages
+		var m=message;
+		dojo.forEach(dojox.cometd._extendInList, function(f){
+			var n=f(m);
+			if(n)m=n;
+		});
+		return m;
+	}
+
+	this._extendOut= function(message){
+		// Handle extensions for inbound messages
+		var m=message;
+		dojo.forEach(dojox.cometd._extendOutList, function(f){
+			var n=f(m);
+			if(n)m=n;
+		});
+		return m;
+	}
+
+
+	this.deliver = function(messages){
+		dojo.forEach(messages, this._deliver, this);
+		return messages;
+	}
+
+	this._deliver = function(message){
+		// dipatch events along the specified path
+		
+		message=this._extendIn(message);
+
+		if(!message["channel"]){
+			if(message["success"] !== true){
+				console.debug("cometd error: no channel for message!", message);
+				return;
+			}
+		}
+		this.lastMessage = message;
+
+		if(message.advice){
+			this._advice = message.advice; // TODO maybe merge?
+		}
+
+		// check to see if we got a /meta channel message that we care about
+		var deferred=null;
+		if(	(message["channel"]) &&
+			(message.channel.length > 5)&&
+			(message.channel.substr(0, 5) == "/meta")){
+			// check for various meta topic actions that we need to respond to
+			switch(message.channel){
+				case "/meta/connect":
+					if(message.successful && !this._connected){
+						this._connected = this._initialized;
+						this.endBatch();
+					} else if(!this._initialized){
+						this._connected = false; // finish disconnect
+					}
+					dojo.publish("/cometd/meta",[{cometd:this,action:"connect",successful:message.successful,state:this.state()}]);
+					break;
+				case "/meta/subscribe":
+					deferred = this._deferredSubscribes[message.subscription];
+					if(!message.successful){
+						if(deferred){
+							deferred.errback(new Error(message.error));
+						}
+						return;
+					}
+					dojox.cometd.subscribed(message.subscription, message);
+					if(deferred){
+						deferred.callback(true);
+					}
+					break;
+				case "/meta/unsubscribe":
+					deferred = this._deferredUnsubscribes[message.subscription];
+					if(!message.successful){
+						if(deferred){
+							deferred.errback(new Error(message.error));
+						}
+						return;
+					}
+					this.unsubscribed(message.subscription, message);
+					if(deferred){
+						deferred.callback(true);
+					}
+					break;
+			}
+		}
+		
+		// send the message down for processing by the transport
+		this.currentTransport.deliver(message);
+
+		if(message.data){
+			// dispatch the message to any locally subscribed listeners
+			try {
+				var tname = "/cometd"+message.channel;
+				dojo.publish(tname, [ message ]);
+			}catch(e){
+				console.debug(e);
+			}
+		}
+	}
+
+	this._sendMessage = function(/* object */ message){
+		if(this.currentTransport && this._connected && this.batch==0){
+			return this.currentTransport.sendMessages([message]);
+		}
+		else{
+			this._messageQ.push(message);
+			return null;
+		}
+	}
+
+	this.startBatch = function(){
+		this.batch++;
+	}
+
+	this.endBatch = function(){
+		if(--this.batch <= 0 && this.currentTransport && this._connected){
+			this.batch=0;
+
+			var messages=this._messageQ;
+			this._messageQ=[];
+			if(messages.length>0){
+				this.currentTransport.sendMessages(messages);
+			}
+		}
+	}
+	
+	this._onUnload = function(){
+		// make this the last of the onUnload method
+		dojo.addOnUnload(dojox.cometd,"disconnect");
+	}
+}
+
+/*
+transport objects MUST expose the following methods:
+	- check
+	- startup
+	- sendMessages
+	- deliver
+	- disconnect
+optional, standard but transport dependent methods are:
+	- tunnelCollapse
+	- tunnelInit
+
+Transports SHOULD be namespaced under the cometd object and transports MUST
+register themselves with cometd.connectionTypes
+
+here's a stub transport defintion:
+
+cometd.blahTransport = new function(){
+	this._connectionType="my-polling";
+	this._cometd=null;
+	this.lastTimestamp = null;
+
+	this.check = function(types, version, xdomain){
+		// summary:
+		//		determines whether or not this transport is suitable given a
+		//		list of transport types that the server supports
+		return dojo.lang.inArray(types, "blah");
+	}
+
+	this.startup = function(){
+		if(dojox.cometd._polling){ return; }
+		// FIXME: fill in startup routine here
+		dojox.cometd._polling = true;
+	}
+
+	this.sendMessages = function(message){
+		// FIXME: fill in message array sending logic
+	}
+
+	this.deliver = function(message){
+	}
+
+	this.disconnect = function(){
+	}
+}
+cometd.connectionTypes.register("blah", cometd.blahTransport.check, cometd.blahTransport);
+*/
+
+dojox.cometd.longPollTransport = new function(){
+	this._connectionType="long-polling";
+	this._cometd=null;
+
+	this.check = function(types, version, xdomain){
+		return ((!xdomain)&&(dojo.indexOf(types, "long-polling") >= 0));
+	}
+
+	this.tunnelInit = function(){
+		var message = {
+			channel:	"/meta/connect",
+			clientId:	this._cometd.clientId,
+			connectionType: this._connectionType,
+			id:	""+this._cometd.messageId++
+		};
+		message=this._cometd._extendOut(message);
+		this.openTunnelWith({message: dojo.toJson([message])});
+	}
+
+	this.tunnelCollapse = function(){
+		// TODO handle transport specific advice
+		
+		if(!this._cometd._initialized){ return; }
+			
+		if(this._cometd._advice){
+			if(this._cometd._advice["reconnect"]=="none"){
+				return;
+			}
+			if(	(this._cometd._advice["interval"])&&
+				(this._cometd._advice.interval>0) ){
+				setTimeout(dojo.hitch(this,function(){ this._connect(); }),this._cometd._advice.interval);
+			}else{
+				this._connect();
+			}
+		}else{
+			this._connect();
+		}
+	}
+
+	this._connect = function(){
+		if(!this._cometd._initialized){ return; }
+		if(this._cometd._polling) {
+			console.debug("wait for poll to complete or fail");
+			return;
+		}
+			
+		if(	(this._cometd._advice) &&
+			(this._cometd._advice["reconnect"]=="handshake")
+		){
+			this._cometd._connected=false;
+			this._initialized = false;
+			this._cometd.init(this._cometd.url,this._cometd._props);
+ 		}else if(this._cometd._connected){
+			var message={
+				channel:	"/meta/connect",
+				connectionType: this._connectionType,
+				clientId:	this._cometd.clientId,
+				id:	""+this._cometd.messageId++
+			};
+			message=this._cometd._extendOut(message);
+			this.openTunnelWith({message: dojo.toJson([message])});
+		}
+	}
+
+	this.deliver = function(message){
+		// Nothing to do
+	}
+
+	this.openTunnelWith = function(content, url){
+		this._cometd._polling = true;
+		var d = dojo.xhrPost({
+			url: (url||this._cometd.url),
+			content: content,
+			handleAs: this._cometd.handleAs,
+			load: dojo.hitch(this, function(data){
+				this._cometd._polling = false;
+				this._cometd.deliver(data);
+				this.tunnelCollapse();
+			}),
+			error: dojo.hitch(this, function(err){
+				this._cometd._polling = false;
+				console.debug("tunnel opening failed:", err);
+				dojo.publish("/cometd/meta", [{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);
+				this._cometd._backoff();
+				this.tunnelCollapse();
+			})
+		});
+	}
+
+	this.sendMessages = function(messages){
+		for(var i=0; i<messages.length; i++){
+			messages[i].clientId = this._cometd.clientId;
+			messages[i].id = ""+this._cometd.messageId++;
+			messages[i]=this._cometd._extendOut(messages[i]);
+		}
+		return dojo.xhrPost({
+			url: this._cometd.url||djConfig["cometdRoot"],
+			handleAs: this._cometd.handleAs,
+			load: dojo.hitch(this._cometd, "deliver"),
+			content: {
+				message: dojo.toJson(messages)
+			}
+		});
+	}
+
+	this.startup = function(handshakeData){
+		if(this._cometd._connected){ return; }
+		this.tunnelInit();
+	}
+
+	this.disconnect = function(){
+		var message={
+			channel:	"/meta/disconnect",
+			clientId:	this._cometd.clientId,
+			id:	""+this._cometd.messageId++
+		};
+		message=this._cometd._extendOut(message);
+		dojo.xhrPost({
+			url: this._cometd.url||djConfig["cometdRoot"],
+			handleAs: this._cometd.handleAs,
+			content: {
+				message: dojo.toJson([message])
+			}
+		});
+	}
+}
+
+dojox.cometd.callbackPollTransport = new function(){
+	this._connectionType = "callback-polling";
+	this._cometd = null;
+
+	this.check = function(types, version, xdomain){
+		// we handle x-domain!
+		return (dojo.indexOf(types, "callback-polling") >= 0);
+	}
+
+	this.tunnelInit = function(){
+		var message = {
+			channel:	"/meta/connect",
+			clientId:	this._cometd.clientId,
+			connectionType: this._connectionType,
+			id:	""+this._cometd.messageId++
+		};
+		message = this._cometd._extendOut(message);		
+		this.openTunnelWith({
+			message: dojo.toJson([message])
+		});
+	}
+
+	this.tunnelCollapse = dojox.cometd.longPollTransport.tunnelCollapse;
+	this._connect = dojox.cometd.longPollTransport._connect;
+	this.deliver = dojox.cometd.longPollTransport.deliver;
+
+	this.openTunnelWith = function(content, url){
+		this._cometd._polling = true;
+		dojo.io.script.get({
+			load: dojo.hitch(this, function(data){
+				this._cometd._polling = false;
+				this._cometd.deliver(data);
+				this.tunnelCollapse();
+			}),
+			error: dojo.hitch(this, function(err){
+				this._cometd._polling = false;
+				console.debug("tunnel opening failed:", err);
+				dojo.publish("/cometd/meta", [{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);
+				this._cometd._backoff();
+				this.tunnelCollapse();
+			}),
+			url: (url||this._cometd.url),
+			content: content,
+			callbackParamName: "jsonp"
+		});
+	}
+
+	this.sendMessages = function(/*array*/ messages){
+		for(var i=0; i<messages.length; i++){
+			messages[i].clientId = this._cometd.clientId;
+			messages[i].id = ""+this._cometd.messageId++;
+			messages[i]=this._cometd._extendOut(messages[i]);
+		}
+		var bindArgs = {
+			url: this._cometd.url||djConfig["cometdRoot"],
+			load: dojo.hitch(this._cometd, "deliver"),
+			callbackParamName: "jsonp",
+			content: { message: dojo.toJson( messages ) }
+		};
+		return dojo.io.script.get(bindArgs);
+	}
+
+	this.startup = function(handshakeData){
+		if(this._cometd._connected){ return; }
+		this.tunnelInit();
+	}
+
+	this.disconnect = dojox.cometd.longPollTransport.disconnect;
+	
+	this.disconnect = function(){
+		var message={
+			channel:"/meta/disconnect",
+			clientId:this._cometd.clientId,
+			id:""+this._cometd.messageId++
+		};
+		message=this._cometd._extendOut(message);		
+		dojo.io.script.get({
+			url: this._cometd.url||djConfig["cometdRoot"],
+			callbackParamName: "jsonp",
+			content: {
+				message: dojo.toJson([message])
+			}
+		});
+	}
+}
+dojox.cometd.connectionTypes.register("long-polling", dojox.cometd.longPollTransport.check, dojox.cometd.longPollTransport);
+dojox.cometd.connectionTypes.register("callback-polling", dojox.cometd.callbackPollTransport.check, dojox.cometd.callbackPollTransport);
+
+dojo.addOnUnload(dojox.cometd,"_onUnload");
+
+}
+
+if(!dojo._hasResource["dojox.cometd"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.cometd"] = true;
+// stub loader for the cometd module since no implementation code is allowed to live in top-level files
+dojo.provide("dojox.cometd");
+
+
+}
+

Added: tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.xd.js
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.xd.js?rev=691359&view=auto
==============================================================================
--- tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.xd.js (added)
+++ tomcat/trunk/webapps/cometd/examples/dojo/dojox/cometd.xd.js Tue Sep  2 13:00:36 2008
@@ -0,0 +1,20 @@
+/*
+	Copyright (c) 2004-2007, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
+*/
+
+/*
+	This is a compiled version of Dojo, built for deployment and not for
+	development. To get an editable version, please visit:
+
+		http://dojotoolkit.org
+
+	for documentation and information on getting the source.
+*/
+
+dojo._xdResourceLoaded({depends:[["provide","dojo.AdapterRegistry"],["provide","dojo.io.script"],["provide","dojox.cometd._base"],["provide","dojox.cometd"]],defineResource:function(_1){if(!_1._hasResource["dojo.AdapterRegistry"]){_1._hasResource["dojo.AdapterRegistry"]=true;_1.provide("dojo.AdapterRegistry");_1.AdapterRegistry=function(_2){this.pairs=[];this.returnWrappers=_2||false;};_1.extend(_1.AdapterRegistry,{register:function(_3,_4,_5,_6,_7){this.pairs[((_7)?"unshift":"push")]([_3,_4,_5,_6]);},match:function(){for(var i=0;i<this.pairs.length;i++){var _9=this.pairs[i];if(_9[1].apply(this,arguments)){if((_9[3])||(this.returnWrappers)){return _9[2];}else{return _9[2].apply(this,arguments);}}}throw new Error("No match found");},unregister:function(_a){for(var i=0;i<this.pairs.length;i++){var _c=this.pairs[i];if(_c[0]==_a){this.pairs.splice(i,1);return true;}}return false;}});}if(!_1._hasResource["dojo.io.script"]){_1._hasResource["dojo.io.script"]=true;_1.provide("dojo.io
 .script");_1.io.script={get:function(_d){var _e=this._makeScriptDeferred(_d);var _f=_e.ioArgs;_1._ioAddQueryToUrl(_f);this.attach(_f.id,_f.url);_1._ioWatch(_e,this._validCheck,this._ioCheck,this._resHandle);return _e;},attach:function(id,url){var _12=_1.doc.createElement("script");_12.type="text/javascript";_12.src=url;_12.id=id;_1.doc.getElementsByTagName("head")[0].appendChild(_12);},remove:function(id){_1._destroyElement(_1.byId(id));if(this["jsonp_"+id]){delete this["jsonp_"+id];}},_makeScriptDeferred:function(_14){var dfd=_1._ioSetArgs(_14,this._deferredCancel,this._deferredOk,this._deferredError);var _16=dfd.ioArgs;_16.id="dojoIoScript"+(this._counter++);_16.canDelete=false;if(_14.callbackParamName){_16.query=_16.query||"";if(_16.query.length>0){_16.query+="&";}_16.query+=_14.callbackParamName+"=dojo.io.script.jsonp_"+_16.id+"._jsonpCallback";_16.canDelete=true;dfd._jsonpCallback=this._jsonpCallback;this["jsonp_"+_16.id]=dfd;}return dfd;},_deferredCancel:function(dfd){
 dfd.canceled=true;if(dfd.ioArgs.canDelete){_1.io.script._deadScripts.push(dfd.ioArgs.id);}},_deferredOk:function(dfd){if(dfd.ioArgs.canDelete){_1.io.script._deadScripts.push(dfd.ioArgs.id);}if(dfd.ioArgs.json){return dfd.ioArgs.json;}else{return dfd.ioArgs;}},_deferredError:function(_19,dfd){if(dfd.ioArgs.canDelete){if(_19.dojoType=="timeout"){_1.io.script.remove(dfd.ioArgs.id);}else{_1.io.script._deadScripts.push(dfd.ioArgs.id);}}console.debug("dojo.io.script error",_19);return _19;},_deadScripts:[],_counter:1,_validCheck:function(dfd){var _1c=_1.io.script;var _1d=_1c._deadScripts;if(_1d&&_1d.length>0){for(var i=0;i<_1d.length;i++){_1c.remove(_1d[i]);}_1.io.script._deadScripts=[];}return true;},_ioCheck:function(dfd){if(dfd.ioArgs.json){return true;}var _20=dfd.ioArgs.args.checkString;if(_20&&eval("typeof("+_20+") != 'undefined'")){return true;}return false;},_resHandle:function(dfd){if(_1.io.script._ioCheck(dfd)){dfd.callback(dfd);}else{dfd.errback(new Error("inconceivable
  dojo.io.script._resHandle error"));}},_jsonpCallback:function(_22){this.ioArgs.json=_22;}};}if(!_1._hasResource["dojox.cometd._base"]){_1._hasResource["dojox.cometd._base"]=true;_1.provide("dojox.cometd._base");dojox.cometd=new function(){this.DISCONNECTED="DISCONNECTED";this.CONNECTING="CONNECTING";this.CONNECTED="CONNECTED";this.DISCONNECTING="DISCONNECING";this._initialized=false;this._connected=false;this._polling=false;this.connectionTypes=new _1.AdapterRegistry(true);this.version="1.0";this.minimumVersion="0.9";this.clientId=null;this.messageId=0;this.batch=0;this._isXD=false;this.handshakeReturn=null;this.currentTransport=null;this.url=null;this.lastMessage=null;this._messageQ=[];this.handleAs="json-comment-optional";this._advice={};this._maxInterval=30000;this._backoffInterval=1000;this._deferredSubscribes={};this._deferredUnsubscribes={};this._subscriptions=[];this._extendInList=[];this._extendOutList=[];this.state=function(){return this._initialized?(this._connect
 ed?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED);};this.init=function(_23,_24,_25){_24=_24||{};_24.version=this.version;_24.minimumVersion=this.minimumVersion;_24.channel="/meta/handshake";_24.id=""+this.messageId++;this.url=_23||djConfig["cometdRoot"];if(!this.url){console.debug("no cometd root specified in djConfig and no root passed");return null;}var _26="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";var _27=(""+window.location).match(new RegExp(_26));if(_27[4]){var tmp=_27[4].split(":");var _29=tmp[0];var _2a=tmp[1]||"80";_27=this.url.match(new RegExp(_26));if(_27[4]){tmp=_27[4].split(":");var _2b=tmp[0];var _2c=tmp[1]||"80";this._isXD=((_2b!=_29)||(_2c!=_2a));}}if(!this._isXD){if(_24.ext){if(_24.ext["json-comment-filtered"]!==true&&_24.ext["json-comment-filtered"]!==false){_24.ext["json-comment-filtered"]=true;}}else{_24.ext={"json-comment-filtered":true};}}_24=this._extendOut(_24);var _2d={url:this.url,handleAs:t
 his.handleAs,content:{"message":_1.toJson([_24])},load:_1.hitch(this,function(msg){this._finishInit(msg);}),error:_1.hitch(this,function(e){console.debug("handshake error!:",e);this._finishInit([{}]);})};if(_25){_1.mixin(_2d,_25);}this._props=_24;for(var _30 in this._subscriptions){for(var sub in this._subscriptions[_30]){if(this._subscriptions[_30][sub].topic){_1.unsubscribe(this._subscriptions[_30][sub].topic);}}}this._messageQ=[];this._subscriptions=[];this._initialized=true;this.batch=0;this.startBatch();var r;if(this._isXD){_2d.callbackParamName="jsonp";r=_1.io.script.get(_2d);}else{r=_1.xhrPost(_2d);}_1.publish("/cometd/meta",[{cometd:this,action:"handshake",successful:true,state:this.state()}]);return r;};this.publish=function(_33,_34,_35){var _36={data:_34,channel:_33};if(_35){_1.mixin(_36,_35);}this._sendMessage(_36);};this.subscribe=function(_37,_38,_39){if(_38){var _3a="/cometd"+_37;var _3b=this._subscriptions[_3a];if(!_3b||_3b.length==0){_3b=[];this._sendMessage(
 {channel:"/meta/subscribe",subscription:_37});var _ds=this._deferredSubscribes;_ds[_37]=new _1.Deferred();if(_ds[_37]){_ds[_37].cancel();delete _ds[_37];}}for(var i in _3b){if(_3b[i].objOrFunc===_38&&(!_3b[i].funcName&&!_39||_3b[i].funcName==_39)){return null;}}var _3e=_1.subscribe(_3a,_38,_39);_3b.push({topic:_3e,objOrFunc:_38,funcName:_39});this._subscriptions[_3a]=_3b;}return this._deferredSubscribes[_37];};this.unsubscribe=function(_3f,_40,_41){var _42="/cometd"+_3f;var _43=this._subscriptions[_42];if(!_43||_43.length==0){return null;}var s=0;for(var i in _43){var sb=_43[i];if((!_40)||(sb.objOrFunc===_40&&(!sb.funcName&&!_41||sb.funcName==_41))){_1.unsubscribe(_43[i].topic);delete _43[i];}else{s++;}}if(s==0){delete this._subscriptions[_42];this._sendMessage({channel:"/meta/unsubscribe",subscription:_3f});this._deferredUnsubscribes[_3f]=new _1.Deferred();if(this._deferredSubscribes[_3f]){this._deferredSubscribes[_3f].cancel();delete this._deferredSubscribes[_3f];}}return 
 this._deferredUnsubscribes[_3f];};this.disconnect=function(){for(var _47 in this._subscriptions){for(var sub in this._subscriptions[_47]){if(this._subscriptions[_47][sub].topic){_1.unsubscribe(this._subscriptions[_47][sub].topic);}}}this._subscriptions=[];this._messageQ=[];if(this._initialized&&this.currentTransport){this._initialized=false;this.currentTransport.disconnect();}if(!this._polling){this._connected=false;_1.publish("/cometd/meta",[{cometd:this,action:"connect",successful:false,state:this.state()}]);}this._initialized=false;_1.publish("/cometd/meta",[{cometd:this,action:"disconnect",successful:true,state:this.state()}]);};this.subscribed=function(_49,_4a){};this.unsubscribed=function(_4b,_4c){};this.tunnelInit=function(_4d,_4e){};this.tunnelCollapse=function(){};this._backoff=function(){if(!this._advice||!this._advice.interval){this._advice={reconnect:"retry",interval:0};}if(this._advice.interval<this._maxInterval){this._advice.interval+=this._backoffInterval;}};t
 his._finishInit=function(_4f){_4f=_4f[0];this.handshakeReturn=_4f;if(_4f["advice"]){this._advice=_4f.advice;}var _50=_4f.successful?_4f.successful:false;if(_4f.version<this.minimumVersion){console.debug("cometd protocol version mismatch. We wanted",this.minimumVersion,"but got",_4f.version);_50=false;this._advice.reconnect="none";}if(_50){this.currentTransport=this.connectionTypes.match(_4f.supportedConnectionTypes,_4f.version,this._isXD);this.currentTransport._cometd=this;this.currentTransport.version=_4f.version;this.clientId=_4f.clientId;this.tunnelInit=_1.hitch(this.currentTransport,"tunnelInit");this.tunnelCollapse=_1.hitch(this.currentTransport,"tunnelCollapse");this.currentTransport.startup(_4f);}_1.publish("/cometd/meta",[{cometd:this,action:"handshook",successful:_50,state:this.state()}]);if(!_50){console.debug("cometd init failed");this._backoff();if(this._advice&&this._advice["reconnect"]=="none"){console.debug("cometd reconnect: none");}else{if(this._advice&&this
 ._advice["interval"]&&this._advice.interval>0){setTimeout(_1.hitch(this,function(){this.init(cometd.url,this._props);}),this._advice.interval);}else{this.init(this.url,this._props);}}}};this._extendIn=function(_51){var m=_51;_1.forEach(dojox.cometd._extendInList,function(f){var n=f(m);if(n){m=n;}});return m;};this._extendOut=function(_55){var m=_55;_1.forEach(dojox.cometd._extendOutList,function(f){var n=f(m);if(n){m=n;}});return m;};this.deliver=function(_59){_1.forEach(_59,this._deliver,this);return _59;};this._deliver=function(_5a){_5a=this._extendIn(_5a);if(!_5a["channel"]){if(_5a["success"]!==true){console.debug("cometd error: no channel for message!",_5a);return;}}this.lastMessage=_5a;if(_5a.advice){this._advice=_5a.advice;}var _5b=null;if((_5a["channel"])&&(_5a.channel.length>5)&&(_5a.channel.substr(0,5)=="/meta")){switch(_5a.channel){case "/meta/connect":if(_5a.successful&&!this._connected){this._connected=this._initialized;this.endBatch();}else{if(!this._initialized
 ){this._connected=false;}}_1.publish("/cometd/meta",[{cometd:this,action:"connect",successful:_5a.successful,state:this.state()}]);break;case "/meta/subscribe":_5b=this._deferredSubscribes[_5a.subscription];if(!_5a.successful){if(_5b){_5b.errback(new Error(_5a.error));}return;}dojox.cometd.subscribed(_5a.subscription,_5a);if(_5b){_5b.callback(true);}break;case "/meta/unsubscribe":_5b=this._deferredUnsubscribes[_5a.subscription];if(!_5a.successful){if(_5b){_5b.errback(new Error(_5a.error));}return;}this.unsubscribed(_5a.subscription,_5a);if(_5b){_5b.callback(true);}break;}}this.currentTransport.deliver(_5a);if(_5a.data){try{var _5c="/cometd"+_5a.channel;_1.publish(_5c,[_5a]);}catch(e){console.debug(e);}}};this._sendMessage=function(_5d){if(this.currentTransport&&this._connected&&this.batch==0){return this.currentTransport.sendMessages([_5d]);}else{this._messageQ.push(_5d);return null;}};this.startBatch=function(){this.batch++;};this.endBatch=function(){if(--this.batch<=0&&thi
 s.currentTransport&&this._connected){this.batch=0;var _5e=this._messageQ;this._messageQ=[];if(_5e.length>0){this.currentTransport.sendMessages(_5e);}}};this._onUnload=function(){_1.addOnUnload(dojox.cometd,"disconnect");};};dojox.cometd.longPollTransport=new function(){this._connectionType="long-polling";this._cometd=null;this.check=function(_5f,_60,_61){return ((!_61)&&(_1.indexOf(_5f,"long-polling")>=0));};this.tunnelInit=function(){var _62={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};_62=this._cometd._extendOut(_62);this.openTunnelWith({message:_1.toJson([_62])});};this.tunnelCollapse=function(){if(!this._cometd._initialized){return;}if(this._cometd._advice){if(this._cometd._advice["reconnect"]=="none"){return;}if((this._cometd._advice["interval"])&&(this._cometd._advice.interval>0)){setTimeout(_1.hitch(this,function(){this._connect();}),this._cometd._advice.interval);}else{this._connect();}}el
 se{this._connect();}};this._connect=function(){if(!this._cometd._initialized){return;}if(this._cometd._polling){console.debug("wait for poll to complete or fail");return;}if((this._cometd._advice)&&(this._cometd._advice["reconnect"]=="handshake")){this._cometd._connected=false;this._initialized=false;this._cometd.init(this._cometd.url,this._cometd._props);}else{if(this._cometd._connected){var _63={channel:"/meta/connect",connectionType:this._connectionType,clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_63=this._cometd._extendOut(_63);this.openTunnelWith({message:_1.toJson([_63])});}}};this.deliver=function(_64){};this.openTunnelWith=function(_65,url){this._cometd._polling=true;var d=_1.xhrPost({url:(url||this._cometd.url),content:_65,handleAs:this._cometd.handleAs,load:_1.hitch(this,function(_68){this._cometd._polling=false;this._cometd.deliver(_68);this.tunnelCollapse();}),error:_1.hitch(this,function(err){this._cometd._polling=false;console.debug("tunnel o
 pening failed:",err);_1.publish("/cometd/meta",[{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse();})});};this.sendMessages=function(_6a){for(var i=0;i<_6a.length;i++){_6a[i].clientId=this._cometd.clientId;_6a[i].id=""+this._cometd.messageId++;_6a[i]=this._cometd._extendOut(_6a[i]);}return _1.xhrPost({url:this._cometd.url||djConfig["cometdRoot"],handleAs:this._cometd.handleAs,load:_1.hitch(this._cometd,"deliver"),content:{message:_1.toJson(_6a)}});};this.startup=function(_6c){if(this._cometd._connected){return;}this.tunnelInit();};this.disconnect=function(){var _6d={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_6d=this._cometd._extendOut(_6d);_1.xhrPost({url:this._cometd.url||djConfig["cometdRoot"],handleAs:this._cometd.handleAs,content:{message:_1.toJson([_6d])}});};};dojox.cometd.callbackPollTransport=new function(){this._connectionType="callback-pol
 ling";this._cometd=null;this.check=function(_6e,_6f,_70){return (_1.indexOf(_6e,"callback-polling")>=0);};this.tunnelInit=function(){var _71={channel:"/meta/connect",clientId:this._cometd.clientId,connectionType:this._connectionType,id:""+this._cometd.messageId++};_71=this._cometd._extendOut(_71);this.openTunnelWith({message:_1.toJson([_71])});};this.tunnelCollapse=dojox.cometd.longPollTransport.tunnelCollapse;this._connect=dojox.cometd.longPollTransport._connect;this.deliver=dojox.cometd.longPollTransport.deliver;this.openTunnelWith=function(_72,url){this._cometd._polling=true;_1.io.script.get({load:_1.hitch(this,function(_74){this._cometd._polling=false;this._cometd.deliver(_74);this.tunnelCollapse();}),error:_1.hitch(this,function(err){this._cometd._polling=false;console.debug("tunnel opening failed:",err);_1.publish("/cometd/meta",[{cometd:this._cometd,action:"connect",successful:false,state:this._cometd.state()}]);this._cometd._backoff();this.tunnelCollapse();}),url:(ur
 l||this._cometd.url),content:_72,callbackParamName:"jsonp"});};this.sendMessages=function(_76){for(var i=0;i<_76.length;i++){_76[i].clientId=this._cometd.clientId;_76[i].id=""+this._cometd.messageId++;_76[i]=this._cometd._extendOut(_76[i]);}var _78={url:this._cometd.url||djConfig["cometdRoot"],load:_1.hitch(this._cometd,"deliver"),callbackParamName:"jsonp",content:{message:_1.toJson(_76)}};return _1.io.script.get(_78);};this.startup=function(_79){if(this._cometd._connected){return;}this.tunnelInit();};this.disconnect=dojox.cometd.longPollTransport.disconnect;this.disconnect=function(){var _7a={channel:"/meta/disconnect",clientId:this._cometd.clientId,id:""+this._cometd.messageId++};_7a=this._cometd._extendOut(_7a);_1.io.script.get({url:this._cometd.url||djConfig["cometdRoot"],callbackParamName:"jsonp",content:{message:_1.toJson([_7a])}});};};dojox.cometd.connectionTypes.register("long-polling",dojox.cometd.longPollTransport.check,dojox.cometd.longPollTransport);dojox.cometd.
 connectionTypes.register("callback-polling",dojox.cometd.callbackPollTransport.check,dojox.cometd.callbackPollTransport);_1.addOnUnload(dojox.cometd,"_onUnload");}if(!_1._hasResource["dojox.cometd"]){_1._hasResource["dojox.cometd"]=true;_1.provide("dojox.cometd");}}});



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org