Hi Marc,

The CXF equivalent of the XFire class is the Bus, so you could do:

Bus bus = BusFactory.getDefaultBus(); // creates a bus and makes it the default bus
....
Endpoint.publish("http://localhost:8080/ctxA";, new ImplementorA());
Endpoint.publish("http://localhost:8080/ctxB";, new ImplementorB());
....
bus.shutdown(true);

Bus.shutdown will shutdown all endpoints, and, as part of that, all http listeners. You can also shutdown endpoints individually, reference counting should take care that the listener on 8080 will eventually be shut down also. On a more granular level, you can access the endpoints' destination, cast it to a JettyHTTPDestination and programatically control the server's behaviour.

Hope that helps,
Andrea.

Marc Baumgartner wrote:

Hi all,

with XFire I have done something like this in my unit tests:

XFireHttpServer httpServer = new XFireHttpServer();
httpServer.setPort(8080);
httpServer.start();
XFire xfire = XFireFactory.newInstance().getXFire();
AnnotationServiceFactory osf = new AnnotationServiceFactory(new
Jsr181WebAnnotations(), xfire.getTransportManager());
...
// Do the test

httpServer.stop();

How can I do something like this with cxf?

Thanks,
M808

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to