This commit is contained in:
Lucas Pleß 2012-03-02 01:18:14 +01:00
parent 0bd6c5acf7
commit 842f3aa8e8
2 changed files with 29 additions and 12 deletions

View File

@ -2,6 +2,7 @@ package de.ctdo.websocket;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.sun.grizzly.tcp.Request; import com.sun.grizzly.tcp.Request;
import com.sun.grizzly.websockets.ProtocolHandler; import com.sun.grizzly.websockets.ProtocolHandler;
@ -11,6 +12,7 @@ import com.sun.grizzly.websockets.WebSocketListener;
import de.ctdo.control.BuntiController; import de.ctdo.control.BuntiController;
@Component
public class BuntiControllerApplication extends WebSocketApplication { public class BuntiControllerApplication extends WebSocketApplication {
Logger logger = LoggerFactory.getLogger(BuntiControllerApplication.class); Logger logger = LoggerFactory.getLogger(BuntiControllerApplication.class);

View File

@ -7,26 +7,41 @@ import javax.servlet.http.HttpServlet;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.sun.grizzly.websockets.WebSocketEngine; import com.sun.grizzly.websockets.WebSocketEngine;
// das klappt so jedenfalls alles noch nicht :)
public class BuntiControllerServlet extends HttpServlet { @Component
public class BuntiControllerServlet { // extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
Logger logger = LoggerFactory.getLogger(BuntiControllerServlet.class); Logger logger = LoggerFactory.getLogger(BuntiControllerServlet.class);
private final BuntiControllerApplication app = new BuntiControllerApplication(); private BuntiControllerApplication app;
@Override @Autowired
public void init(ServletConfig config) throws ServletException { public void setApp(BuntiControllerApplication app) {
WebSocketEngine.getEngine().register(app); this.app = app;
logger.debug("registered BuntiControllerApplication");
} }
@Override
public void destroy() {
WebSocketEngine.getEngine().unregister(app); public void BuntiControllerApplication() {
logger.debug("unregistered 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");
// }
} }