You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kynan Fraser <ky...@customware.net> on 2009/09/25 08:43:47 UTC

[JAX-RS] - Is it possible to get a handle to the JAXRSServiceFactoryBean class configured via spring?

Hi All,

I'm trying to find a way to get the list of resource classes at runtime when
everything is wired up by spring but can't find a way to get at it. 

I'm pretty sure i need JAXRSServiceFactoryBean.getClassResourceInfo() which
seems to be wired up via the JAXRSServerFactoryBean but can't find any
context object to get it from?

Alternatively, is there a context object we can query spring beans from?

Thanks,
Kynan
-- 
View this message in context: http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25607213.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: [JAX-RS] - Is it possible to get a handle to the JAXRSServiceFactoryBean class configured via spring?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Kynan

MessageContext has methods like get() which can get a property from a current message and getContextualProperty which can also check
a current Exchange but I've checked the code and there's no way to get to a list of ClassResourceInfos from that context (yet)...
However, you can just do :

Message currentMessage =

org.apache.cxf.phase.PhaseInterceptorChain.getCurrentMessage();

and proceed from there

hope it helps, Sergey

>
> Hi Sergey,
>
> Sorry, yes I should have been more explicit. This is needed not on a message
> event but from some other code at runtime (assume no specific message
> available).
>
> I did take a quick look at available objects on the MessageContext but
> couldn't find what I was after.
>
> Thanks,
> Kynan
>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>> Here's how you can get to the complete list of (root) resources from a
>> custom filter (assuming your endpoint has few of them) :
>> Endpoint e = message.getExchange().get(Endpoint.class);
>>
>> ((JAXRSServiceImpl)e.getService()).getClassResourceInfos();
>>
>> or would you like to get to this list from the application code ?
>> It might be possible to get to this list from a CXF-specific
>> MessageContext...
>>
>> cheers, Sergey
>>
>>>
>>> Hi All,
>>>
>>> I'm trying to find a way to get the list of resource classes at runtime
>>> when
>>> everything is wired up by spring but can't find a way to get at it.
>>>
>>> I'm pretty sure i need JAXRSServiceFactoryBean.getClassResourceInfo()
>>> which
>>> seems to be wired up via the JAXRSServerFactoryBean but can't find any
>>> context object to get it from?
>>>
>>> Alternatively, is there a context object we can query spring beans from?
>>>
>>> Thanks,
>>> Kynan
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25607213.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context:
> http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25638663.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: [JAX-RS] - Is it possible to get a handle to the JAXRSServiceFactoryBean class configured via spring?

Posted by Kynan Fraser <ky...@customware.net>.
Hi Sergey,

Sorry, yes I should have been more explicit. This is needed not on a message
event but from some other code at runtime (assume no specific message
available).

I did take a quick look at available objects on the MessageContext but
couldn't find what I was after.

Thanks,
Kynan


Sergey Beryozkin-2 wrote:
> 
> Hi
> 
> Here's how you can get to the complete list of (root) resources from a
> custom filter (assuming your endpoint has few of them) :
> Endpoint e = message.getExchange().get(Endpoint.class);
> 
> ((JAXRSServiceImpl)e.getService()).getClassResourceInfos();
> 
> or would you like to get to this list from the application code ?
> It might be possible to get to this list from a CXF-specific
> MessageContext...
> 
> cheers, Sergey
> 
>>
>> Hi All,
>>
>> I'm trying to find a way to get the list of resource classes at runtime
>> when
>> everything is wired up by spring but can't find a way to get at it.
>>
>> I'm pretty sure i need JAXRSServiceFactoryBean.getClassResourceInfo()
>> which
>> seems to be wired up via the JAXRSServerFactoryBean but can't find any
>> context object to get it from?
>>
>> Alternatively, is there a context object we can query spring beans from?
>>
>> Thanks,
>> Kynan
>> -- 
>> View this message in context: 
>> http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25607213.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25638663.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: [JAX-RS] - Is it possible to get a handle to the JAXRSServiceFactoryBean class configured via spring?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

Here's how you can get to the complete list of (root) resources from a custom filter (assuming your endpoint has few of them) :
Endpoint e = message.getExchange().get(Endpoint.class);

((JAXRSServiceImpl)e.getService()).getClassResourceInfos();

or would you like to get to this list from the application code ?
It might be possible to get to this list from a CXF-specific MessageContext...

cheers, Sergey

>
> Hi All,
>
> I'm trying to find a way to get the list of resource classes at runtime when
> everything is wired up by spring but can't find a way to get at it.
>
> I'm pretty sure i need JAXRSServiceFactoryBean.getClassResourceInfo() which
> seems to be wired up via the JAXRSServerFactoryBean but can't find any
> context object to get it from?
>
> Alternatively, is there a context object we can query spring beans from?
>
> Thanks,
> Kynan
> -- 
> View this message in context: 
> http://www.nabble.com/-JAX-RS----Is-it-possible-to-get-a-handle-to-the-JAXRSServiceFactoryBean-class-configured-via-spring--tp25607213p25607213.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>