mirror of https://github.com/apache/activemq.git
a couple of Stomp improvements
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@741109 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c22cd6563b
commit
690b7bcbd1
|
@ -161,7 +161,7 @@ public class ProtocolConverter {
|
|||
*
|
||||
* @param command
|
||||
*/
|
||||
public void onStompCommad(StompFrame command) throws IOException, JMSException {
|
||||
public void onStompCommand(StompFrame command) throws IOException, JMSException {
|
||||
try {
|
||||
|
||||
if (command.getClass() == StompFrameError.class) {
|
||||
|
@ -459,6 +459,8 @@ public class ProtocolConverter {
|
|||
throw new ProtocolException("No subscription matched.");
|
||||
}
|
||||
|
||||
ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
|
||||
protected void onStompConnect(final StompFrame command) throws ProtocolException {
|
||||
|
||||
if (connected.get()) {
|
||||
|
@ -472,7 +474,6 @@ public class ProtocolConverter {
|
|||
String passcode = headers.get(Stomp.Headers.Connect.PASSCODE);
|
||||
String clientId = headers.get(Stomp.Headers.Connect.CLIENT_ID);
|
||||
|
||||
final ConnectionInfo connectionInfo = new ConnectionInfo();
|
||||
|
||||
IntrospectionSupport.setProperties(connectionInfo, headers, "activemq.");
|
||||
|
||||
|
@ -540,6 +541,7 @@ public class ProtocolConverter {
|
|||
|
||||
protected void onStompDisconnect(StompFrame command) throws ProtocolException {
|
||||
checkConnected();
|
||||
sendToActiveMQ(connectionInfo.createRemoveCommand(), createResponseHandler(command));
|
||||
sendToActiveMQ(new ShutdownInfo(), createResponseHandler(command));
|
||||
connected.set(false);
|
||||
}
|
||||
|
@ -556,7 +558,7 @@ public class ProtocolConverter {
|
|||
* @param command
|
||||
* @throws IOException
|
||||
*/
|
||||
public void onActiveMQCommad(Command command) throws IOException, JMSException {
|
||||
public void onActiveMQCommand(Command command) throws IOException, JMSException {
|
||||
if (command.isResponse()) {
|
||||
|
||||
Response response = (Response)command;
|
||||
|
|
|
@ -107,9 +107,16 @@ public class StompConnection {
|
|||
}
|
||||
|
||||
public void connect(String username, String password) throws Exception {
|
||||
connect(username, password, null);
|
||||
}
|
||||
|
||||
public void connect(String username, String password, String client) throws Exception {
|
||||
HashMap<String, String> headers = new HashMap();
|
||||
headers.put("login", username);
|
||||
headers.put("passcode", password);
|
||||
if (client != null) {
|
||||
headers.put("client-id", client);
|
||||
}
|
||||
StompFrame frame = new StompFrame("CONNECT", headers);
|
||||
sendFrame(frame.toString());
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class StompTransportFilter extends TransportFilter {
|
|||
public void oneway(Object o) throws IOException {
|
||||
try {
|
||||
final Command command = (Command)o;
|
||||
protocolConverter.onActiveMQCommad(command);
|
||||
protocolConverter.onActiveMQCommand(command);
|
||||
} catch (JMSException e) {
|
||||
throw IOExceptionSupport.create(e);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class StompTransportFilter extends TransportFilter {
|
|||
if (trace) {
|
||||
LOG.trace("Received: \n" + command);
|
||||
}
|
||||
protocolConverter.onStompCommad((StompFrame)command);
|
||||
protocolConverter.onStompCommand((StompFrame)command);
|
||||
} catch (IOException e) {
|
||||
onException(e);
|
||||
} catch (JMSException e) {
|
||||
|
|
Loading…
Reference in New Issue