The @Path#value javadoc<
https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/Path.html#value()> is missing the ABNF for “regex”. It only includes:
param = "{" *WSP name *WSP [ ":" *WSP regex *WSP ] "}"
name = (ALPHA / DIGIT / "_")*(ALPHA / DIGIT / "." / "_" / "-" ) ; \w[\w\.-]*
My 1st preference is:
regex = *( nonbrace / "{" *nonbrace "}" )
nonbrace = any char other than "{" and "}"
It allows a regex like “\d{1,10}” (matching between 1 and 10 digits).
Only a deliberately diabolical regex won’t be accepted (eg “[^}]*”).
I suspect Marc might prefer my 2nd preference:
regex = *nonbrace
nonbrace = any char other than "}"
This is a little simpler.
It disallows a regex like “\d{1,10}”, though it could be rewritten as “\d\d?\d?\d?\d?\d?\d?\d?\d?\d?”.
[Earlier discussion on this issue: from
https://jsr311.dev.java.net/servlets/ReadMsg?list=users&msgNo=538]
Allowing spaces and tabs (WSP) in a placeholder seems a bit unnecessary. I guess it doesn’t do much harm, though I wouldn’t be surprised if some code used the regex “\s*” or String.trim() to implement *WSP, which is not quite correct.
James Manger
P.S. RFC 2234 “ABNF” has been replaced by RFC 5234 “ABNF”.