Guest User

websocket cdi inject problem

a guest
Nov 23rd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. @WebServlet(urlPatterns = "/copylobby", asyncSupported = true, loadOnStartup = 1)
  2. public class CopyOfWebSocketLobbyServlet extends WebSocketServlet implements
  3. IWebSocketLobby {
  4.  
  5. private static final long serialVersionUID = 2844592471347413432L;
  6.  
  7. private final Logger LOGGER = LoggerFactory.getLogger(getClass().getName());
  8.  
  9. @Inject
  10. private ObjectMapper jsonProvider;
  11.  
  12. public void init() throws ServletException {
  13. LOGGER.info("Initialize Lobby WebSocket servlet");
  14. super.init();
  15. }
  16.  
  17. /*
  18. * (non-Javadoc)
  19. *
  20. * @see
  21. * org.apache.catalina.websocket.WebSocketServlet#createWebSocketInbound
  22. * (java.lang.String, javax.servlet.http.HttpServletRequest)
  23. */
  24. @Override
  25. protected StreamInbound createWebSocketInbound(String arg0,
  26. HttpServletRequest request) {
  27. // do sth...
  28.  
  29. }
  30.  
  31. @Override
  32. public void addConnection(LobbyKey lobbyKey,
  33. AbstractLobbyMessageInbound lobbyConnection) {
  34. LOGGER.info("adding a connection + {}", jsonProvider.getClass()
  35. .getSimpleName());
  36.  
  37. }
  38.  
  39. @Override
  40. public void removeConnection(LobbyKey lobbyKey,
  41. AbstractLobbyMessageInbound lobbyConnection) {
  42. LOGGER.info("removing a connection + {}", jsonProvider.getClass()
  43. .getSimpleName());
  44.  
  45. }
  46.  
  47. @Override
  48. public void processTextCommand(String jsonCommand,
  49. AbstractLobbyMessageInbound lobbyConnection) {
  50. LOGGER.info("processing a message: |{}|", jsonCommand);
  51. LOGGER.info("message + {}", jsonProvider.getClass().getSimpleName());
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment