Hi

Hi

If you're using Spring then please have a look at trunk/systests/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml. something like this will do :
<jaxrs:server id="bookservice" address="/">
   <jaxrs:serviceBeans>
   <ref bean="petstore" />
   <ref bean="bookstore" />
 </jaxrs:serviceBeans>
  <jaxrs:entityProviders>
      <bean class="org.apache.cxf.systest.jaxrs.BadgerFishProvider" />
 </jaxrs:entityProviders>
</jaxrs:server>

Now, Jersey and other JAX_RS implementation would pick up the provider from the classpath, just annotating a custom provider with @Provider annotation would be sufficient. CXF is not capable of doing it yet. I'm not actually sure I like very much the idea of scanning the class path, should be fine in the simple scenarious but might cause classpath-like clash issues if say multiple custom providers for a certain type like Atom Feed or JAXB are availbale on the classpath. That said, this is something CXF will likely support, it's one of those areas where a patch would also be welcome.

If you don't do Spring then you can do

JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(CustomerService.class);
// add you custom providerList<?> providers = ...;provider.add(new 
CustomProvider());sf.setEntityProviders(listOfProviders);
sf.create();
Hope it helps, Sergey
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to