Hi
On 02/10/12 07:43, Rudi wrote:
This *almost* works :

        <bean class="org.apache.cxf.jaxrs.JAXRSServerFactoryBean"
                init-method="init">
                <property name="address" value="/api" />
                <property name="providers">
                        <list>
                                <bean 
class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
                                <bean 
class="org.soluvas.jaxrs.Jackson2ContextResolver">
                                        <argument ref="jacksonMapperFactory"/>
                                </bean>
                        </list>
                </property>

                <property name="serviceBeans">
                        <list>
                                <ref component-id="productRsShop"/>
                        </list>


                </property>
        </bean>

Problem is, even if I provide a dynamic List implementation to
setServiceBeans(), it is only read once and the resource beans created
during org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create() live for the
entire duration of the jaxrs:server.

Even calling this method : void
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setServiceBeans(List beans)
has no effect if the JAXRSServer is already started.


I think the best way to handle this issue is to use JAX-RS subresources, example:

@Path("/")
public class Root {

   @Path("dynamic")
   public RootSub get() {
      return getFirstRootSubFromQueue();
   }

   class RootSub {
      @GET
      public Book get() {...}
   }
}

So a RootSub instance will be selected dynamically to get "GET /dynamic" requests handled...

Cheers, Sergey

Rudi




--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-use-dynamic-list-of-JAX-RS-resources-in-a-jaxrs-server-and-attaching-JAX-RS-Application-instae-tp5715291p5715303.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to