简体   繁体   English

使用ServiceMix 7 M3和CXF生成的WADL中缺少方法ID属性

[英]Missing method id attribute in generated WADL with ServiceMix 7 M3 and CXF

We are using ServiceMix 7.0.0.M3 and use the CXF WADL generator. 我们正在使用ServiceMix 7.0.0.M3,并使用CXF WADL生成器。 Now the generated WADL does not seem to have a 'id' attribute in the resource>method tags. 现在,生成的WADL在resource> method标签中似乎没有'id'属性。 For example, the 4th line in the following WADL does not have an 'id' attribute. 例如,以下WADL中的第四行没有'id'属性。

<resources base="http://localhost:8181/api/rest/box">
   <resource path="/">
      <resource path="boxes">
         <method name="GET">
            <request>
               <param name="language" style="header" type="xs:string"/>
               <param name="includeInactive" style="query" type="xs:boolean"/>
            </request>
            <response>
               <representation mediaType="application/json;charset=utf-8" element="prefix1:BoxRestResponse"/>
            </response>
         </method>
      </resource>

If I would have the WADL generated with Jersey, I would get an 'id' property, containing the name of the corresponding Java method. 如果要用Jersey生成WADL,我将获得一个'id'属性,其中包含相应Java方法的名称。

<resources base="http://localhost:8181/api/rest/box">
   <resource path="/">
      <resource path="boxes">
         <method name="GET" id="getBoxes">
            <request>
               <param name="language" style="header" type="xs:string"/>
               <param name="includeInactive" style="query" type="xs:boolean"/>
            </request>
            <response>
               <representation mediaType="application/json;charset=utf-8" element="prefix1:BoxRestResponse"/>
            </response>
         </method>
      </resource>

One of our frontend development tools expects the 'id' attribute to be present. 我们的前端开发工具之一期望'id'属性存在。

Is it possible to configure the CXF WADL generator to include the method id attribute? 是否可以将CXF WADL生成器配置为包括方法id属性?

I found it. 我找到了。 The id's are generated when adding the WadlGenerator configuration property 'addResourceAndMethodIds' to the CXF Blueprint file: 将WadlGenerator配置属性'addResourceAndMethodIds'添加到CXF蓝图文件时,将生成ID:

   <bean id="wadlGenerator" class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
        <!-- properties: Method Summaries @ https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.html -->
        <property name="linkJsonToXmlSchema" value="true" />
        <property name="useJaxbContextForQnames" value="true" />
        <property name="addResourceAndMethodIds" value="true" />
    </bean>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM