Hello,
I have just very recently been reading up about WADL and have been
trying to map the URLs in my web site/application. I've encountered
some issues, and have a few suggestions for a future draft of WADL.
First, how would I reference the root of my domain? From reading the
spec, it looks like I need to just do @path="" but that looks wrong to
me. The schema agrees with it, and Mark's stylesheet handles it
correctly, but having an empty attribute like that just feels wrong.
Which brings me to my next point.
Is there any reason that the path attributes were designed to not
include the leading "/" character? (like almost every other product
I've seen that uses paths does.) Was it simply a matter of it could've
gone one way or the other and it was a matter of preference on behalf
of the original author, or is there some other technical reason I'm
not aware of?
If it was just a matter of preference, and there are no other specs
out there that say it has to be done this way, I'd like to offer my
recommendations to section 2.5.1
1) Allow @path segments to begin with a leading slash. If the
identifier at this point ends with a slash, and the path begins with a
slash, then the leading slash on the path is dropped. (only one slash
in final identifier)
2) If neither the identifier or the path contain the slash character
in their appropriate positions, then a slash is added between them,
unless the resource element contains a @omit-path-separator="true"
attribute. (subject to better name)
The first rule would allow people to start their @path segments with
or without a slash according to taste without breaking existing WADL
documents. The second rule would allow people to nest resource
elements without each level introducing another path. With these two
rules, it would be possible to do things like this:
<resources base="
http://www.example.com/">
<resource path="/">
<resource path="news/{year}" omit-path-separator="true">
<param name="year" style="template" type="xs:int"/>
<resource path="-{month}" omit-path-separator="true">
<param name="month" style="template" type="xs:int"/>
<resource path="-{day}" omit-path-separator="true">
<param name="day" style="template" type="xs:int"/>
This would allow URLs such as:
http://www.example.com/
http://www.example.com/news/2007
http://www.example.com/news/2007-5 (anyone know if xs:int has
a problem with '05'?)
http://www.example.com/news/2007-5-11
One thing I did notice when writing this out, care would have to be
taken that @path="/" is treated as a preceding slash, and not as a
trailing slash. (or at least that it's not counted as both)
So, any feedback on this? It would make identifier processing a bit
harder, but I think it would give the WADL author quite a bit more
flexibility. I appreciate any responses.
--
Daniel E. Renfer
http://kronkltd.net/