Hi
On 26/08/13 18:06, sambit wrote:
Hi,
I have a use case where i want to get the details of the service
implementation class mapped to a jaxrs:serviceBean for a jaxrs:server at
runtime during start up.
<jaxrs:server address="http://localhost:8080/jaxrs">
<jaxrs:serviceBeans>
<ref bean="serviceBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
Is there a way, i can get a handle to ClassResourceInfo at server start up
from where i can find out the implementation class details.
Perhaps you may want to experiment with
http://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/DynamicFeature.html
The runtime will callback providing ResourceInfo for all service beans,
http://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/ResourceInfo.html
so that 2.0 filters or writers can be dynamically bound. I guess you can
even use this feature simply to do some other checks on ResourceInfo.
CXF also ships ServerLifecycleListener, very useful article from Oliver
can be found here:
http://owulff.blogspot.ie/2011/10/how-to-enable-interceptor-without.html
If you go this route, in your listener implementation, you can do
Service service = server.getEndpoint().getService();
((JAXRSServiceImpl)service).getClassResourceInfos();
this will return a list of all service bean representations
HTH, Sergey
--
View this message in context:
http://cxf.547215.n5.nabble.com/service-implementation-class-info-at-start-up-tp5733091.html
Sent from the cxf-user mailing list archive at Nabble.com.