Hi,


I would like to set up a service invoker for all my endpoints by somehow 
configuring the CXF Bus, but so far with no much success.



I tried this:



public class ServiceCleanupFeature extends AbstractFeature {
public class ServiceCleanupFeature extends AbstractFeature {
    @Override
    public void initialize(Server server, Bus bus) {
        Service service = server.getEndpoint().getService();
        service.setInvoker(new ServiceCleanupInvoker(service.getInvoker()));
    }

}



But then when configuring the feature at bus level it fails (NPE) because there 
is no endpoint at that stage.\

Is there a best practice of how to set up a service invoker for all endpoints?

Should I use an interceptor? If yes, how?



Best Regards,

Yossi Cohen



> On Dec 13, 2013, at 10:39 PM, "Daniel Kulp" 
> <[email protected]<mailto:[email protected]>> wrote:

>

>

>> On Dec 13, 2013, at 3:17 PM, Yossi Cohen 
>> <[email protected]<mailto:[email protected]>> wrote:

>>

>> Thank you Daniel, that's great news.

>> How does CXF resolve feature name into a qualified class name?

>> E.g., does it use this convention demonstrated below:

>> <cxf:myFeature/>

>>

>> Then our class should implement Feature and have the name 
>> X.Y…MyFeatureFeature?

>

> No, you would need to use the <bean class=“…”/> form instead of a  
> <cxf:XXXX/> form.   Anything in one of the “cxf” namespaces has to be defined 
> explicitely in the CXF schemas or Spring will complain about them at 
> validation time.   We’ve defined a few for our common ones (like logging) but 
> not for all of them.

>

> You COULD write your own namespace handler and schemas and such for your own, 
> but that gets complex.   For simple things like a single feature, it’s easier 
> to just use the <bean …> form.

>

> Dan

>

>

>

>

>>

>> Best Regards,

>> Yossi Cohen

>> (Sent from my iPad)

>>

>>> On Dec 13, 2013, at 4:50 PM, "Daniel Kulp" 
>>> <[email protected]<mailto:[email protected]>> wrote:

>>>

>>>

>>>> On Dec 13, 2013, at 9:08 AM, Yossi Cohen 
>>>> <[email protected]<mailto:[email protected]>> wrote:

>>>>

>>>> Thank you Freeman Fang.

>>>>

>>>> Regarding:

>>>>

>>>> <cxf:bus>

>>>>     <cxf:features>

>>>>     your feature here

>>>>     </cxf:features>

>>>> </cxf:bus>

>>>>

>>>> All the examples I found were about adding a feature defined into

>>>> cxf namespace, e.g.,  <cxf:logging/>

>>>>

>>>> Is it explained anywhere how to define my own custom feature?

>>>

>>> Yep.   Just create an object that implements the 
>>> org.apache.cxf.feature.Feature interface.

>>>

>>>> And second (more important for me right now), is it possible to just list 
>>>> the beans implementing Feature, e.g.:

>>>>

>>>> <cxf:bus>

>>>>     <cxf:features>

>>>>            <list>

>>>>                   <ref bean="feature1" />

>>>>                  <ref bean=" feature2" />

>>>>           </list>

>>>>    </cxf:features

>>>> </cxf:bus>

>>>

>>> The cxf:features element is a list so it would just be:

>>>

>>> <cxf:features>

>>> <ref bean=“feature1”/>

>>> <ref bean=“feature2”/>

>>> </cxf:features>

>>>

>>>

>>> Dan

>>>

>>>>

>>>> Best Regards,

>>>> Yossi Cohen

>>>>

>>>>

>>>> -----Original Message-----

>>>> From: Freeman Fang [mailto:[email protected]]

>>>> Sent: Friday, December 13, 2013 10:27 AM

>>>> To: [email protected]<mailto:[email protected]>

>>>> Subject: Re: Autowire CXF Bus

>>>>

>>>> Hi,

>>>>

>>>> My comment inline

>>>> -------------

>>>> Freeman(Yue) Fang

>>>>

>>>> Red Hat, Inc.

>>>> FuseSource is now part of Red Hat

>>>>

>>>>

>>>>

>>>>> On 2013-12-13, at 下午4:18, Yossi Cohen wrote:

>>>>>

>>>>> Hello,

>>>>>

>>>>> I use CXF, Spring and Tomcat. What way can CXF Feature be added 
>>>>> programmatically to CXF Bus instance? What way can this be done via CXF 
>>>>> XML (at bus level)?

>>>>

>>>> Something like

>>>> <cxf:bus>

>>>>     <cxf:features>

>>>>     your feature here

>>>>     </cxf:features>

>>>> </cxf:bus>

>>>>

>>>>> Also, if I do not want configure a bunch of features separately, does it 
>>>>> make sense to aggregate them within a newly created Feature (see below)?

>>>>>

>>>>> public class MyCompositeFeature extends AbstractFeature {

>>>>> @Override public void initialize(Server server, Bus bus) {

>>>>>   AbstractFeature feature = new ServiceCleanupFeature();

>>>>>   bus.getFeatures().add(feature);

>>>>>   feature.initialize(server, bus); } }

>>>>

>>>> Yep, you can do this way

>>>>>

>>>>> Thanks,

>>>>> Yossi

>>>>>

>>>>>

>>>>> This message and the information contained herein is proprietary

>>>>> and confidential and subject to the Amdocs policy statement, you

>>>>> may review at http://www.amdocs.com/email_disclaimer.asp

>>>>

>>>>

>>>> This message and the information contained herein is proprietary

>>>> and confidential and subject to the Amdocs policy statement, you

>>>> may review at http://www.amdocs.com/email_disclaimer.asp

>>>

>>> --

>>> Daniel Kulp

>>> [email protected]<mailto:[email protected]> - http://dankulp.com/blog Talend 
>>> Community Coder -

>>> http://coders.talend.com

>

> --

> Daniel Kulp

> [email protected]<mailto:[email protected]> - http://dankulp.com/blog Talend 
> Community Coder -

> http://coders.talend.com

>

This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp

Reply via email to