update to beta10 of jetty

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@384163 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gregory John Wilkins 2006-03-08 09:17:14 +00:00
parent 5628c2d94b
commit 9430890dc7
3 changed files with 34 additions and 18 deletions

View File

@ -129,11 +129,7 @@ var chatBehaviours =
element.setAttribute("autocomplete","OFF"); element.setAttribute("autocomplete","OFF");
element.onkeyup = function(ev) element.onkeyup = function(ev)
{ {
var keyc; var keyc=getKeyCode(ev);
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
if (keyc==13 || keyc==10) if (keyc==13 || keyc==10)
{ {
room.join(); room.join();
@ -157,11 +153,7 @@ var chatBehaviours =
element.setAttribute("autocomplete","OFF"); element.setAttribute("autocomplete","OFF");
element.onkeyup = function(ev) element.onkeyup = function(ev)
{ {
var keyc; var keyc=getKeyCode(ev);
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
if (keyc==13 || keyc==10) if (keyc==13 || keyc==10)
{ {

View File

@ -1,9 +1,18 @@
// AMQ handler // AMQ Ajax handler
// This class provides the main API for using the Ajax features of AMQ. It
// allows JMS messages to be sent and received from javascript when used
// with the org.apache.activemq.web.MessageListenerServlet
//
var amq = var amq =
{ {
// The URI of the MessageListenerServlet
uri: '/amq',
// Polling. Set to true (default) if waiting poll for messages is needed
poll: true, poll: true,
_first: true, _first: true,
_pollEvent: function(first) {}, _pollEvent: function(first) {},
_handlers: new Array(), _handlers: new Array(),
@ -73,17 +82,20 @@ var amq =
if (amq._messages==0) if (amq._messages==0)
{ {
if (amq.poll) if (amq.poll)
new Ajax.Request('/amq', { method: 'get', onSuccess: amq._pollHandler }); new Ajax.Request(amq.uri, { method: 'get', onSuccess: amq._pollHandler });
} }
else else
{ {
var body = amq._messageQueue+'&poll='+amq.poll; var body = amq._messageQueue+'&poll='+amq.poll;
amq._messageQueue=''; amq._messageQueue='';
amq._messages=0; amq._messages=0;
new Ajax.Request('/amq', { method: 'post', onSuccess: amq._pollHandler, postBody: body }); new Ajax.Request(amq.uri, { method: 'post', onSuccess: amq._pollHandler, postBody: body });
} }
}, },
// Add a function that gets called on every poll response, after all received
// messages have been handled. The poll handler is past a boolean that indicates
// if this is the first poll for the page.
addPollHandler : function(func) addPollHandler : function(func)
{ {
var old = amq._pollEvent; var old = amq._pollEvent;
@ -94,6 +106,8 @@ var amq =
} }
}, },
// Send a JMS message to a destination (eg topic://MY.TOPIC). Message should be xml or encoded
// xml content.
sendMessage : function(destination,message) sendMessage : function(destination,message)
{ {
amq._sendMessage(destination,message,'send'); amq._sendMessage(destination,message,'send');
@ -107,9 +121,10 @@ var amq =
}, },
// remove Listener from channel or topic. // remove Listener from channel or topic.
removeListener : function(destination) removeListener : function(id,destination)
{ {
amq._sendMessage(destination,'','unlisten'); amq._handlers[id]=null;
amq._sendMessage(destination,id,'unlisten');
}, },
_sendMessage : function(destination,message,type) _sendMessage : function(destination,message,type)
@ -121,16 +136,25 @@ var amq =
} }
else else
{ {
new Ajax.Request('/amq', { method: 'post', postBody: 'destination='+destination+'&message='+message+'&type='+type}); new Ajax.Request(amq.uri, { method: 'post', postBody: 'destination='+destination+'&message='+message+'&type='+type});
} }
}, },
_startPolling : function() _startPolling : function()
{ {
if (amq.poll) if (amq.poll)
new Ajax.Request('/amq', { method: 'get', parameters: 'timeout=0', onSuccess: amq._pollHandler }); new Ajax.Request(amq.uri, { method: 'get', parameters: 'timeout=0', onSuccess: amq._pollHandler });
} }
}; };
Behaviour.addLoadEvent(amq._startPolling); Behaviour.addLoadEvent(amq._startPolling);
function getKeyCode(ev)
{
var keyc;
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
return keyc;
}

View File

@ -139,7 +139,7 @@ commons_httpclient_version=2.0.1
#servlet_api_version=2.5-6.0-SNAPSHOT #servlet_api_version=2.5-6.0-SNAPSHOT
servlet_api_version=2.5-6.0.0beta6 servlet_api_version=2.5-6.0.0beta6
#jetty_version=6.0-SNAPSHOT #jetty_version=6.0-SNAPSHOT
jetty_version=6.0.0beta6 jetty_version=6.0.0beta10
tomcat_version=5.0.28 tomcat_version=5.0.28
xercesImpl_version=2.6.2 xercesImpl_version=2.6.2