Hi all,
I'm trying to use the HTTP bundles to setup some websockets. For my example
I've created an implementation of the abstract WebSocketServlet which only
has a configure method implemented.
This "configure" method has a WebSocketServletFactory as only argument,
which is used to register a WebSocket.
public class MyWebSocketServlet extends WebSocketServlet {
@Override
public void configure(WebSocketServletFactory arg0) {
arg0.register(MyWebSocket.class);
}
}
The WebSocket has one method and uses annotations to mark it as a Socket
with a Message.
@WebSocket
public class MyWebSocket {
@OnWebSocketMessage
public void onText(Session session, String message) {
if (session.isOpen()) {
System.out.printf("Echoing back message [%s]%n", message);
session.getRemote().sendString(message, null);
}
}
}
I've tried registering this servlet using the whiteboard handler, as well
as directly to the http service. In both scenarios I run in a
ClassNotFoundException for the WebSocketServletFactory.
What am I doing wrong? How am I supposed to use websockets with the http
bundles (preferably using the whiteboard pattern).
The same question has also been asked on stackoverflow [1], but no answer
is given, although there is a pointer to the underlying issue.
[1]:
http://stackoverflow.com/questions/29099699/osgi-bundle-in-felix-classnotfoundexception-for-jetty-class-loaded-by-name
Thanks in advance,
--
Met vriendelijke groet,
Alexander Broekhuis