CXF and multiple servlet mappings

We currently have a Java webapp with Spring MVC DispatcherServlet and two CXFServlets. DispatcherServlet is the default servlet (mapping / ), one CXFServlet maps to /api/* , and the other to /services/* .

What bothers me is that it seems impossible to have 1 CXFServlet that hosts 2 services, one on /api/v0 and one on /services/myService , without matching /* with CXFServlet. If possible, this will save initialization time, problems with the configuration and memory of another instance of the servlet.

Basically, my question is, does anyone know how to host 2 CXF services on 2 URLs in 1 CXFServlet without a common base / root URL, preferably using Spring namespace configuration, without matching /* with CXFServlet?

+6
source share
1 answer

The invoke CXF ServletController method first calls HttpServletRequest#getPathInfo , which returns part of the requested URL without the url-pattern servlet. The result of this call is then used to match any specific service by calling DestinationRegistry#getDestinationForPath . Therefore, it is currently not possible to have CXF matching services using the path with the servlet part included - CXF never calls the HttpServletRequest#getServletPath , which is needed for this.

Note that the base-address value that can be set in the servlet initialization parameters ( <init-param> ) will only affect any URLs displayed by CXF, since the ServletController#getBaseURL method that uses this value is not used during a service call.

+3
source

All Articles