How to define variable Resource such as /colours/{colour} in a WADL?

≯℡__Kan透↙ 提交于 2019-12-24 07:07:09

问题


Is it possible to define the fact that you are expecting a {colour} in the /colours/{colour} URL as part of a WADL? If so, how would you do it? If not, isn't this a huge oversight of the spec?

Why can't I do something like this to define /colours/{colour}:

    <resource path="colours" id="Colours">
      <resource id="colour" uri="{colour}">
        <method name="GET" id="get_colour"/>
      </resource>
    </resource>

Thanks in advance.


回答1:


Found the answer: http://cxf.apache.org/docs/jaxrs-services-description.html

You can define it as a param with a style of template, e.g:

<resource path="colours" id="Colours">
    <param name="colour" style="template" required="true"/>
    <method name="GET" id="get_colour"/>
</resource>


来源:https://stackoverflow.com/questions/9111935/how-to-define-variable-resource-such-as-colours-colour-in-a-wadl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!