On 27/02/2014 14:03, Johan Compagner wrote: > Like what is described here? > > http://dev.eclipse.org/mhonarc/lists/jetty-dev/msg01999.html > > > ServerContainer container = > (ServerContainer)context.getAttribute("javax.websocket.server.ServerContainer" > ); > try > { > container.addEndpoint(EchoSocket.class);
You can do it exactly like that. <snip/> > this is what i just tried: > > Catalina catalina = new Catalina(); > catalina.setParentClassLoader(new > OSGIWebappClassLoader(TomcatStarter.class.getClassLoader())); > catalina.load(); > Service[] services = catalina.getServer().findServices(); > for (Service service : services) { > Container[] containers = service.getContainer().findChildren(); > for (Container host : containers) { > Container[] contexts = host.findChildren(); > for (Container container : contexts) { > StandardContext sc = (StandardContext) container; > ServletContext context = sc.getServletContext(); > ServerContainer serverContainer = > (ServerContainer)context.getAttribute("javax.websocket.server.ServerContainer"); > System.err.println(serverContainer); > > But that attribute doesn't seem to be there at least at that time > > Any body an idea? You haven't started the Context so the attributes won't have been populated. Try adding a ContextListener to the context and use that to set up the endpoints using the programmatic API. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org