开发者

Representing arbitrary hierarchies in WADL

开发者 https://www.devze.com 2023-01-10 01:56 出处:网络
I am modeling a REST API and part of the API will represent resources that are organized into an arbitrary hierarchy of nodes with values and sub-nodes (kind

I am modeling a REST API and part of the API will represent resources that are organized into an arbitrary hierarchy of nodes with values and sub-nodes (kind of like a file system or the windows registry).

I would love to create a WADL file so that i can generate the JAX-RS boilerplate for the API but i'm not sure how to represent such a situation in WADL.

i could just use a string as a template parameter but i'm not sure how i would detect that that string parameter is allowed to have slashes in its value and generate the JAX-RS @Path annotation properly.

Is it 开发者_开发知识库legit to create a template parameter that is repeatable and expect that sort of functionality? e.g.

HTTP GET http://my.service.com/registry/path/to/my/node

where the repeated template params are "path", "to", "my", "node" ?


If you look at the current draft URI template spec there exists a template that describes what you want:

  http://my.service/com/registry{/list*}

I have no idea if any WADL tooling actually is capable of parsing all the templates that are defined in the spec yet. I don't use WADL, and don't recommend it, so I can't help you there.

0

精彩评论

暂无评论...
验证码 换一张
取 消