Skip to content

Commit

Permalink
update to beta10 of jetty
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@384163 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Gregory John Wilkins committed Mar 8, 2006
1 parent 5628c2d commit 9430890
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
12 changes: 2 additions & 10 deletions activemq-web/src/main/webapp/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ var chatBehaviours =
element.setAttribute("autocomplete","OFF");
element.onkeyup = function(ev)
{
var keyc;
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
var keyc=getKeyCode(ev);
if (keyc==13 || keyc==10)
{
room.join();
Expand All @@ -157,11 +153,7 @@ var chatBehaviours =
element.setAttribute("autocomplete","OFF");
element.onkeyup = function(ev)
{
var keyc;
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
var keyc=getKeyCode(ev);

if (keyc==13 || keyc==10)
{
Expand Down
38 changes: 31 additions & 7 deletions activemq-web/src/main/webapp/js/amq.js
Original file line number Diff line number Diff line change
@@ -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 =
{
// The URI of the MessageListenerServlet
uri: '/amq',

// Polling. Set to true (default) if waiting poll for messages is needed
poll: true,

_first: true,
_pollEvent: function(first) {},
_handlers: new Array(),
Expand Down Expand Up @@ -73,17 +82,20 @@ var amq =
if (amq._messages==0)
{
if (amq.poll)
new Ajax.Request('/amq', { method: 'get', onSuccess: amq._pollHandler });
new Ajax.Request(amq.uri, { method: 'get', onSuccess: amq._pollHandler });
}
else
{
var body = amq._messageQueue+'&poll='+amq.poll;
amq._messageQueue='';
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)
{
var old = amq._pollEvent;
Expand All @@ -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)
{
amq._sendMessage(destination,message,'send');
Expand All @@ -107,9 +121,10 @@ var amq =
},

// 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)
Expand All @@ -121,16 +136,25 @@ var amq =
}
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()
{
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);

function getKeyCode(ev)
{
var keyc;
if (window.event)
keyc=window.event.keyCode;
else
keyc=ev.keyCode;
return keyc;
}
2 changes: 1 addition & 1 deletion etc/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.0beta6
#jetty_version=6.0-SNAPSHOT
jetty_version=6.0.0beta6
jetty_version=6.0.0beta10
tomcat_version=5.0.28
xercesImpl_version=2.6.2

Expand Down

0 comments on commit 9430890

Please sign in to comment.