我试图在我们的HTML5客户端使用。我已经在一个java客户机中实现了它,并且它工作了。LoginHandler似乎有一个问题。当我调试代码时,它在LoginHandler中以一个没完没了的循环结束。线路回调(新的PasswordAuthentication(usr,pwd))一次又一次地被调用:
// Configure a Basic Challenge Handler
var basicHandler = new BasicChallengeHandler();
basicHandler.loginHandler = function(callback) {
callback(new PasswordAuthentication(usr, pwd));
}
JmsConnectionProperties jmsProps = new JmsConnectionProperties();
jmsProps.connectionTimeout = 1000000;
jmsProps.reconnectAttemptsMax = -1;
jmsProps.reconnectDelay = 3000;
jmsProps.shutdownDelay = 5000;
console.log("Connect to: " + url);
// Create Connection Factory
jmsConnectionFactory = new JmsConnectionFactory(url, jmsProps);
websocketFactory = jmsConnectionFactory.getWebSocketFactory();
websocketFactory.setChallengeHandler(basicHandler);
// reate Connection future handler for the result
try {
if (connection == null) {
var connectionFuture = jmsConnectionFactory.createConnection( function() {
try {
// never comes to this line!!!
connection = connectionFuture.getValue();
// DO SOME STUFF
} catch (e) {
console.dir(e);
// alert(e.message);
}
});
} else {
try {
connection.close(function() { /* Closed */
});
} finally {
connection = null;
}
}
} catch (ex) {
console.dir(ex);
}任何帮助都将不胜感激!
问候安吉拉
发布于 2015-01-29 07:21:01
是否有可能用户名和密码组合不正确,从而使客户端再次受到挑战?
https://stackoverflow.com/questions/28194313
复制相似问题