Wednesday, August 26, 2015

Using websockets with wicket 7 and embedded jetty (9.2.X)

I had a hell of a time getting the new wicket websockets functionality to work with embedded jetty.
The information I found on the interwebs left tantalizing clues, but one piece of vital information was missing.  For those landing here, I'll cut to the chase:


WebAppContext webapp = new WebAppContext();
webapp.setServer(server);
webapp.setContextPath("/");
webapp.setWar("src/main/webapp");
server.setHandler(webapp);

ServerContainer wscontainer = WebSocketServerContainerInitializer.
    configureContext(webapp);
wscontainer.addEndpoint(
    new org.apache.wicket.protocol.ws.javax.WicketServerEndpointConfig() );


Adding the endpoint was the missing piece of the puzzle.

No comments: