From 842f3aa8e8c5cb1e5961aa373f183245caeed13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Fri, 2 Mar 2012 01:18:14 +0100 Subject: [PATCH] tests --- .../websocket/BuntiControllerApplication.java | 2 + .../websocket/BuntiControllerServlet.java | 39 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerApplication.java b/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerApplication.java index 74f76cf..a46e546 100644 --- a/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerApplication.java +++ b/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerApplication.java @@ -2,6 +2,7 @@ package de.ctdo.websocket; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; import com.sun.grizzly.tcp.Request; import com.sun.grizzly.websockets.ProtocolHandler; @@ -11,6 +12,7 @@ import com.sun.grizzly.websockets.WebSocketListener; import de.ctdo.control.BuntiController; +@Component public class BuntiControllerApplication extends WebSocketApplication { Logger logger = LoggerFactory.getLogger(BuntiControllerApplication.class); diff --git a/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerServlet.java b/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerServlet.java index 6c91c36..d0a04c2 100644 --- a/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerServlet.java +++ b/bunti_server/src/main/java/de/ctdo/websocket/BuntiControllerServlet.java @@ -7,26 +7,41 @@ import javax.servlet.http.HttpServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import com.sun.grizzly.websockets.WebSocketEngine; - -public class BuntiControllerServlet extends HttpServlet { +// das klappt so jedenfalls alles noch nicht :) +@Component +public class BuntiControllerServlet { // extends HttpServlet { private static final long serialVersionUID = 1L; Logger logger = LoggerFactory.getLogger(BuntiControllerServlet.class); - private final BuntiControllerApplication app = new BuntiControllerApplication(); - - @Override - public void init(ServletConfig config) throws ServletException { - WebSocketEngine.getEngine().register(app); - logger.debug("registered BuntiControllerApplication"); + private BuntiControllerApplication app; + + @Autowired + public void setApp(BuntiControllerApplication app) { + this.app = app; } - @Override - public void destroy() { - WebSocketEngine.getEngine().unregister(app); - logger.debug("unregistered BuntiControllerApplication"); + + + public void BuntiControllerApplication() { +// WebSocketEngine.getEngine().register(app); +// logger.debug("registered BuntiControllerApplication"); } + +// @Override +// public void init(ServletConfig config) throws ServletException { +// WebSocketEngine.getEngine().register(app); +// logger.debug("registered BuntiControllerApplication"); +// } +// +// @Override +// public void destroy() { +// WebSocketEngine.getEngine().unregister(app); +// logger.debug("unregistered BuntiControllerApplication"); +// } }