We are currently porting an existing JBoss EJB application to a pure servlet solution which is supposed to run in a Jetty (we\'re currently using version 6, but the version is m
We finally solved it quite elegantly by extending CXFNonSpringServlet. You simply override the loadBus() method where you can configure all your service endpoints.
@Singleton
public class SoapServlet extends CXFNonSpringServlet {
private static final long serialVersionUID = 1L;
private final SomeFacade someFacade;
@Inject
SoapMachineServlet(final SomeFacade someFacade) {
this.someFacade = someFacade;
}
@Override
public void loadBus(ServletConfig servletConfig) throws ServletException {
super.loadBus(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
Endpoint.publish("/SomeFacade", someFacade);
}
}
The class itself is a simply a servlet, which can then be bound using a ServletModule:
public class SomeModule extends ServletModule {
@Override
protected void configureServlets() {
serve("/some/path*").with(SoapServlet.class);
}
}