I am creating a web service with spring + jetty + cxf using the following:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="helloWorld" implementor="com.test.EndpointImp" address="http://localhost:9002/test">
</jaxws:endpoint>
This all works as expected and very well. Now I need to “serve” some servlets. Is there anyway I can get to the jetty Server instance that is created for this, so that I can add the servlets? I dont want to create another Jetty instance on another port just for the servlets I need to use.
Any information will be greatly appreciated.
The solution you are looking for is described in this article. The key points (which I also mentioned in my post) are to use
org.apache.cxf.transport.servlet.CXFServletin yourweb.xml, don’t forget to importMETA-INF/cxf/cxf-servlet.xml(you did so) and also use relativeaddress="/myservice"attribute. In this case CXF routines will not launch embedded Jetty but use this servlet for processing the inbound requests.