Refine destination semantics for msg-handling methods

After this change, annotated message handling methods configured to use
a destination prefix (e.g. "/app") no longer have to include the prefix
in their mapping. For example if a client sends a message to "/app/foo"
the annotated methods should be mapped with @MessageMapping("/foo").
This commit is contained in:
Rossen Stoyanchev
2013-09-03 11:04:00 -04:00
parent e1a46bb57a
commit 0ac6998e60
20 changed files with 325 additions and 126 deletions

View File

@@ -50,7 +50,7 @@ public class LoggingWebSocketHandlerDecorator extends WebSocketHandlerDecorator
@Override
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("Received " + message + ", " + session);
logger.debug(message + ", " + session);
}
super.handleMessage(session, message);
}

View File

@@ -26,7 +26,6 @@ import org.apache.coyote.http11.Http11NioProtocol;
import org.apache.tomcat.util.descriptor.web.ApplicationListener;
import org.apache.tomcat.websocket.server.WsListener;
import org.springframework.core.NestedRuntimeException;
import org.springframework.util.Assert;
import org.springframework.util.SocketUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
@@ -94,9 +93,10 @@ public class TomcatWebSocketTestServer implements WebSocketTestServer {
@Override
public void undeployConfig() {
Assert.notNull(this.context, "deployConfig/undeployConfig must be invoked in pairs");
this.context.removeServletMapping("/");
this.tomcatServer.getHost().removeChild(this.context);
if (this.context != null) {
this.context.removeServletMapping("/");
this.tomcatServer.getHost().removeChild(this.context);
}
}
@Override