问题
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