views:

38

answers:

0

HI all,

I have written a web service which is running fine in java 6 embedded web server (com.sun.net.httpserver.HttpServer). I have now to switch to grizzly as the java server has a selection key bug, but I do not find any way how I can directly publish the webservice to grizzly. My code is now as following:

final GrizzlyWebServer ws = new GrizzlyWebServer(9999); 
final WSServlet wsServlet = new WSServlet();
final ServletAdapter wsa = new ServletAdapter(wsServlet);
wsa.addServletListener("com.sun.xml.ws.transport.http.servlet.WSServletContextListener");
ws.addGrizzlyAdapter(wsa, new String[] { "/ws" }); ws.start();

This works fine, but is not exeactly what I need as I have to provide a sun-jaxws.xml file as deployment descriptor. I would prefer the following way which I have used for the java 6 embedded server:

final HttpContext context = server.createContext("/ws");
final Endpoint endpoint =
Endpoint.create(serviceImplementation);
endpoint.publish(context);

So my question is: Is there a way to create a http context for an embedded grizzly and publish my webservice to grizzly? I have also tried to use jetty and it worked but I need to run my webservice in grizzly.

Thank you very much for any help,

Maciej