use of javax.websocket.server.ServerContainer in project undertow by undertow-io.
the class AddEndpointServlet method init.
@Override
public void init(ServletConfig c) throws ServletException {
String websocketPath = "/foo";
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(ProgramaticEndpoint.class, websocketPath).build();
ServerContainer serverContainer = (ServerContainer) c.getServletContext().getAttribute("javax.websocket.server.ServerContainer");
try {
serverContainer.addEndpoint(config);
} catch (DeploymentException ex) {
throw new ServletException("Error deploying websocket endpoint:", ex);
}
}
Aggregations