Jerome Louvel wrote:
> Hi Arjohn,
>
> Good suggestion regarding the constants naming. I've just renamed routing
> mode constants of Router to follow the MODE_*_MATCH pattern such as
> MODE_BEST_MATCH instead of BEST. Deprecated older values.
OK, thanks.
> Regarding the enums, we did consider them in several places but they prevent
> addition of new constants by the framework or by the developer, especially
> without breaking existing code. They also produce extra artifacts in the
> Javadocs cluttering them.
Fair enough. We did a similar evaluation for our project (openrdf
sesame), where we decided to use enums where extensibility isn't an
issue and enum-like classes otherwise. The javadoc clutter isn't too
bad in our case.
> For your latest question, I would recommend adding two routes: "/abc" and
> "/abc/{path}". Then, it is possible to configure the "path" variable to say
> it should match all URI characters including slashes via the
> Variable#TYPE_URI_ALL constant, setting the Template#defaultVariable#type
> property or adding an entry to Template#variables maps.
Thanks for your help with this one.
I'm wondering if and how this mechanism can be simplified a bit by
making the template mechanism more powerful. One option could be to
encode the matching type in the variable string. I can imagine using a
notation like {digit:ssn} or {path:dirs} to respectively encode a
TYPE_DIGIT and a TYPE_URI_PATH variable.
Ant's notation where * matches a segment and ** matches a path could
also be a useful extension. In my case, I could then simply declare the
second route as "/abc/**".
Any thoughts?
Cheers,
Arjohn
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2416507