Whoops! The x } must have snuck in. I've made the changes as suggested and I
have tried to remove all externalities by putting the two .html files in to
the activem-web-demo source and running mvn jetty6:run. I am also running
greasemonkey with the XMLHttpRequest debugging script.
MessageListener.html
=============
<html>
<head>
<title>MessageListener Test</title>
<script type="text/javascript" src="amq/amq.js"></script>
<script type="text/javascript">amq.uri='amq';</script>
<script type="text/javascript">
var feedHandler =
{
_feed: function(message)
{
alert("received: " +message);
document.getElementById("result").innerHTML =
message;
}
};
function chartPoll(first)
{
if (first)
{
amq.addListener('charts','topic://MY.TEST',feedHandler._feed);
}
}
amq.addPollHandler(chartPoll);
</script>
</head>
<body>
<h1>Message Listener</h1>
<hr/>
<div id="result"></div>
</body>
</html>
XMLHttpRequest Output
===============
All reports produce:
GET amq
X-Requested-With:XMLHttpRequest
X-Prototype-Version:1.4.0
null
200 (OK)
Content-Type: text/xml; charset=ISO-8859-1
Cache-Control: no-cache
Content-Length: 35
Connection: keep-alive
Server: Jetty(6.0.x)
<ajax-response>
</ajax-response>
MessagePublisher.html
==============
<html>
<head>
<title>Message Publishing</title>
<script type="text/javascript" src="amq/amq.js"></script>
<script type="text/javascript">amq.uri='amq';</script>
<script type="text/javascript">
function publishMessage() {
amq.sendMessage("topic://MY.TEST","sadfasdfasdfasdf");
}
</script>
</head>
<body>
<form action="#">
<input type="button" value="Publish Message"
onclick="publishMessage();"/>
</form>
</body>
</html>
XMLHttpRequest Output
===============
Two reports occur, first:
POST amq
X-Requested-With:XMLHttpRequest
X-Prototype-Version:1.4.0
Content-type:application/x-www-form-urlencoded
Connection:close
destination=topic://MY.TEST&message=sadfasdfasdfasdf&type=send
200 (OK)
Content-Type: text/plain; charset=ISO-8859-1
Cache-Control: no-cache
Connection: close
Server: Jetty(6.0.x)
ID:RACETEXT01-1931-1151048582000-3:0:1:1:1
second report:
GET amq
X-Requested-With:XMLHttpRequest
X-Prototype-Version:1.4.0
null
200 (OK)
Content-Type: text/xml; charset=ISO-8859-1
Cache-Control: no-cache
Content-Length: 35
Connection: keep-alive
Server: Jetty(6.0.x)
<ajax-response>
</ajax-response>
--
View this message in context: http://www.nabble.com/AJAX-t1829608.html#a5007683
Sent from the ActiveMQ - User forum at Nabble.com.