cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yaytay (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6062) Interceptors added in Spring Bus configuration are ignored
Date Wed, 12 Nov 2014 10:15:34 GMT

    [ https://issues.apache.org/jira/browse/CXF-6062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14207895#comment-14207895
] 

Yaytay commented on CXF-6062:
-----------------------------

The workaround is to repackage your interceptors using a [CXF Feature|http://cxf.apache.org/docs/features.html].
You can see from the code excerpted from BusDefinitionParser.java that features don't use
a getter and thus avoid the problem.
Irritating then, but not a complete blocker.

> Interceptors added in Spring Bus configuration are ignored 
> -----------------------------------------------------------
>
>                 Key: CXF-6062
>                 URL: https://issues.apache.org/jira/browse/CXF-6062
>             Project: CXF
>          Issue Type: Bug
>          Components: Bus
>    Affects Versions: 3.0.2
>            Reporter: Andrea Silva
>            Priority: Critical
>
> Given a basic spring bus configuration like the following:
> {code}
> ...
> <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
> <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>  
>     <cxf:bus>
>         <cxf:inInterceptors>
>             <ref bean="logInbound"/>
>         </cxf:inInterceptors>
>         <cxf:outInterceptors>
>             <ref bean="logOutbound"/>
>         </cxf:outInterceptors>
>         <cxf:outFaultInterceptors>
>             <ref bean="logOutbound"/>
>         </cxf:outFaultInterceptors>
>         <cxf:inFaultInterceptors>
>             <ref bean="logInbound"/>
>         </cxf:inFaultInterceptors>
>     </cxf:bus> 
> ...
> {code} 
> the logInbound and logOutbound interceptors are not added to the bus, when the spring
configuration is parsed.
> I think the problem is in BusDefinitionParser.java, more specifically in the setBus method
of BusConfig class.
> {code}
> public void setBus(Bus bb) {
>     if (bus == bb) {
>         return;
>     }
>     bus = bb;
>     if (properties != null) {
>         bus.setProperties(properties);
>         properties = null;
>     }
>     if (!getInInterceptors().isEmpty()) {
>         bus.getInInterceptors().addAll(getInInterceptors());
>     }
>     if (!getOutInterceptors().isEmpty()) {
>         bus.getOutInterceptors().addAll(getOutInterceptors());
>     }
>     if (!getInFaultInterceptors().isEmpty()) {
>         bus.getInFaultInterceptors().addAll(getInFaultInterceptors());
>     }
>     if (!getOutFaultInterceptors().isEmpty()) {
>         bus.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
>     }
>     if (!StringUtils.isEmpty(id)) {
>         bus.setId(id);
>     }
>     if (features != null) {
>         bus.setFeatures(features);
>         features = null;
>     }
> }
> {code}
> If the bus is assigned at the beginning of the method (bus = bb) no new Interceptor will
be added as the getXYZInterceptors methods will return the interceptors already included in
the bus.
> {code}
> public List<Interceptor<? extends Message>> getXYZInterceptors() {
>             if (bus != null) {
>                 return bus.getXYZInterceptors();
>             }
>             return super.getXYZInterceptors();
> }
> {code}
> A fix could be something along the line of:
> {code}
> public void setBus(Bus bb) {
>     if (bus == bb) {
>         return;
>     }
>     
>     if (properties != null) {
>         bb.setProperties(properties);
>         properties = null;
>     }
>     if (!getInInterceptors().isEmpty()) {
>         bb.getInInterceptors().addAll(getInInterceptors());
>     }
>     if (!getOutInterceptors().isEmpty()) {
>         bb.getOutInterceptors().addAll(getOutInterceptors());
>     }
>     if (!getInFaultInterceptors().isEmpty()) {
>         bb.getInFaultInterceptors().addAll(getInFaultInterceptors());
>     }
>     if (!getOutFaultInterceptors().isEmpty()) {
>         bb.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
>     }
>     if (!StringUtils.isEmpty(id)) {
>         bb.setId(id);
>     }
>     if (features != null) {
>         bb.setFeatures(features);
>         features = null;
>     }
>     bus = bb;
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message