Hello everyone.

Problem demonstration

I have REST API with these endpoints:

[main(----) dia] REST route: GET /api/category/all []
[main(----) dia] REST route: POST /api/category/filter ["f"]
[main(----) dia] REST route: GET /api/category/:id []
[main(----) dia] REST route: POST /api/category/create ["c"]
[main(----) dia] REST route: PUT /api/category/:id/update ["c"]
[main(----) dia] REST route: DELETE /api/category/:id []

REST interface generator registers these OPTIONS handlers:

[main(----) dia] REST route: OPTIONS /api/category/:id []
[main(----) dia] REST route: OPTIONS /api/category/:id/update ["c"]
[main(----) dia] REST route: OPTIONS /api/category/all []
[main(----) dia] REST route: OPTIONS /api/category/create ["c"]
[main(----) dia] REST route: OPTIONS /api/category/filter ["f"]

Looks good, but on
curl -v 'http://127.0.0.1:8080/api/category/all' -X 'OPTIONS'
I get

route match: /api/category/all -> OPTIONS /api/category/:id ["all"]

The same happens with
curl -v 'http://127.0.0.1:8080/api/category/filter' -X 'OPTIONS'

route match: /api/category/filter -> OPTIONS /api/category/:id ["filter"]

Problem cause

If there are routes with the same HTTP method like
/foo/:var
/foo/bar
/foo/baz
URLRouter always matches /foo/:var, but registerRestInterface() implementeation does not take this into account.

Solution options

1) Rewrite registerRestInterface() OPTIONS handlers generation.
2) Fix URLRouter matching algorithm.

I think #2 is better, but I need Sönke Ludwig (or someone else in charge) opinion on this before diving into that (prefix?) MatchTree internals.