Change CXF based address in OSGI Service

By default, CXF will mapping CXFServlet to /cxf context path. I used Servicemix 4.5 which using CXF 2.7.3 inside. its define static in osgiservlet.xml in cxf-rt-transport-http (FYI, for CXF 2.7.3, they are using transport-http ver. 2.6.3). So, based on default configuration, all our CXF service will result like http://localhost:8181/cxf/myservice, this is not good. because sometimes you want define service itself.

This default based address mapping can changes with following instruction :

  1. open (or make a new file if doesn’t exist) org.apache.cxf.osgi.cfg in ${SMX_PATH}/etc folder.
  2. put org.apache.cxf.servlet.context = /yourservice

alternatively, you can using config:edit command inside servicemix osgi container :

  1. config:edit org.apache.cxf.osgi
  2. config:propset org.apache.cxf.servlet.context /yourservice
  3. config:update

To activated these configuration, you need to restart your container.

best regards,

tandatangankecil

 

Leave a Reply

Your email address will not be published. Required fields are marked *