Monday, April 16, 2012

Quick Note on How to remove/change /cxf from context path of CXF OSGi service.

By Default, when a CXF servlet endpoint is deployed in Servicemix OSGi container the context path for the endpoint address contains "/cxf".
This causes resulting endpoint URL being something like http://localhost:9090/cxf/myservice . This is not always a desirable URL and many times needed to change to more generic (technology neutral) URL for publishing the endpoint.

This default context can be changed in one of the two ways as follows:

1. It can be changed by adding org.apache.cxf.servlet.context=/myservice to etc/org.apache.cxf.osgi.cfg.

2. By running following commands to alter configuration in container using configuration management service in Servicemix container.
       config:edit org.apache.cxf.osgi
       config:propset org.apache.cxf.servlet.context /myservice