You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jonathan <as...@gmail.com> on 2011/01/21 15:03:54 UTC

cxf-busextension.xml workaround ?

Hi,

I am using cxf 2.3.2 in oder to create WebServices with jax-ws annotation. I
use the CXFNonSpringServlet for the transport and it works just fine.

The thing is that I am taking advantage of the cxf-minimal-bundle with the
cxf.xml,cxf-busextension.xml and so on configuration embedded. Since I don't
need the woodstox and jax-rs extension I have commented the corresponding
lines in the cxf-busextension.xml within the bundle/jar.

In that way I don't have to resolved dependencies for woodstox and jax-rs.

Here are the commented lines:
  <!--
  <extension
class="org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl"
interface="org.apache.cxf.io.StaxValidationManager" />
  <extension class="org.apache.cxf.jaxrs.JAXRSBindingFactory"
interface="org.apache.cxf.binding.BindingFactory" deferred="true">
    <namespace>http://apache.org/cxf/binding/jaxrs</namespace>
  </extension>
  -->

It works fine but for some reasons I don't want to have to modified the file
within the cxf-minimal-bundle before deploying it. So,  is it possible  to
configure the cxf bus extension at runtime from
an other xml file or an InputStream ?

I have seen that is possible to add an extension with the Bus.setExtension
method, but i was wondering if there is a way for -reloading- a given xml
file which contained the extension ?

Thanks you,

---
Jonathan

Re: cxf-busextension.xml workaround ?

Posted by Willem Jiang <wi...@gmail.com>.
On 1/21/11 10:03 PM, jonathan wrote:
> Hi,
>
> I am using cxf 2.3.2 in oder to create WebServices with jax-ws annotation. I
> use the CXFNonSpringServlet for the transport and it works just fine.
>
> The thing is that I am taking advantage of the cxf-minimal-bundle with the
> cxf.xml,cxf-busextension.xml and so on configuration embedded. Since I don't
> need the woodstox and jax-rs extension I have commented the corresponding
> lines in the cxf-busextension.xml within the bundle/jar.
>
> In that way I don't have to resolved dependencies for woodstox and jax-rs.
>
> Here are the commented lines:
>    <!--
>    <extension
> class="org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl"
> interface="org.apache.cxf.io.StaxValidationManager" />
>    <extension class="org.apache.cxf.jaxrs.JAXRSBindingFactory"
> interface="org.apache.cxf.binding.BindingFactory" deferred="true">
>      <namespace>http://apache.org/cxf/binding/jaxrs</namespace>
>    </extension>
>    -->
>
> It works fine but for some reasons I don't want to have to modified the file
> within the cxf-minimal-bundle before deploying it. So,  is it possible  to
> configure the cxf bus extension at runtime from
> an other xml file or an InputStream ?
CXF is using below code to load the XML.

Thread.currentThread().getContextClassLoader().getResources(resource);

This means you can't override the original cxf-busextension.xml by 
placing a new one in front of the class path.

>
> I have seen that is possible to add an extension with the Bus.setExtension
> method, but i was wondering if there is a way for -reloading- a given xml
> file which contained the extension ?
>
I suggest you to use maven shade plugin[1] to build a new bundle which 
is based on the CXF one , and override the cxf-busextenstion.xml that way.

[1]http://maven.apache.org/plugins/maven-shade-plugin/

> Thanks you,
>
> ---
> Jonathan
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang