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);


i need a way to add fully programatically a Websocket endpoint to the
context/container

i also can't use the ApplicationConfig because that one also needs to be
scanned by tomcat first
the classes are not in the web app. they are coming from osgi and are
provided by the system
So i need a way to add them on the fly to a context

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?

(it doesn't have to be a standard servlet way, i can use the tomcat api
itself if needed)

johan
-- 
Johan Compagner
Servoy

Reply via email to