cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4903) jaxws:handlers is not treated as a list in ServerFactoryBeanDefinitionParser
Date Wed, 20 Mar 2013 06:47:15 GMT

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

Freeman Fang commented on CXF-4903:
-----------------------------------

Hi,

The ServerFactoryBeanDefinitionParser(org.apache.cxf.frontend.blueprint.ServerFactoryBeanDefinitionParser)
is used for the simple frontend, but jaxws:handler is used for jaxws frontend, so simple frontend
doesn't have jaxws:handler at all.

I checked the code for jaxws frontend, both for spring(org.apache.cxf.jaxws.spring.EndpointDefinitionParser)
and blueprint(org.apache.cxf.jaxws.blueprint.EndpointDefinitionParser) configuration, the
handlers is parsed as list.

Back to your configuration,  you should use some thing like
{code}
<jaxws:handlers>

<!-FIRST get the login data from the cas login ticket header->
<bean class="ServiceTicketServerSOAPHandler" />
<!--SECOND get the username and map it to an applicationCode to be stored in the threadlocal
-->
<bean class="ApplicationCodeSoapHandler" />

</jaxws:handlers>
{code}

Note: there should not be a <list></list> in jaxws:handlers.

Freeman
                
> jaxws:handlers is not treated as a list in ServerFactoryBeanDefinitionParser
> ----------------------------------------------------------------------------
>
>                 Key: CXF-4903
>                 URL: https://issues.apache.org/jira/browse/CXF-4903
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>            Reporter: kris beaumont
>            Assignee: Freeman Fang
>
> I find this in the code:
>  @Override
>     protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element
el, String name) {
>         if ("properties".equals(name)) {
>             Map<?, ?> map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
>             bean.addPropertyValue("properties", map);
>         } else if ("executor".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.executor");
>         } else if ("invoker".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.invoker");
>         } else if ("binding".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
>         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
>             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
>             || "features".equals(name) || "schemaLocations".equals(name)) {
>             List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
>             bean.addPropertyValue(name, list);
>         } else {
>             setFirstChildAsProperty(el, ctx, bean, name);            
>         }        
>     }
>     
> where I think the list treatment should also be done for the "handlers" property (that
now uses the setFirstChildAsProperty default=> only one handler from the 'list' is added.
> So for this definition:
>   <!---->
>     <jaxws:server id="webService" address="/lightWS" >
>         <jaxws:handlers>
>             <list>
>                 <!--FIRST get the login data from the cas login ticket header-->
>                 <bean class="ServiceTicketServerSOAPHandler"  />
>                 <!--SECOND get the username and map it to an applicationCode to be
stored in the threadlocal -->
>                 <bean class="ApplicationCodeSoapHandler" />
>             </list>
>         </jaxws:handlers>
>         <jaxws:serviceBean>
>             <ref bean="webServiceImpl" />
>         </jaxws:serviceBean>
>     </jaxws:server>
> In the end I only have the first handler and not both, which should be easy to fix with:
>  @Override
>     protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element
el, String name) {
>         if ("properties".equals(name)) {
>             Map<?, ?> map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
>             bean.addPropertyValue("properties", map);
>         } else if ("executor".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.executor");
>         } else if ("invoker".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.invoker");
>         } else if ("binding".equals(name)) {
>             setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
>         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
>             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
>             || "features".equals(name) || "schemaLocations".equals(name)
>             || "handlers".equals(name) //also include the handlers
> ) {
>             List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
>             bean.addPropertyValue(name, list);
>         } else {
>             setFirstChildAsProperty(el, ctx, bean, name);            
>         }        
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message