How should I approach parsing URI parameters in a REST API. For example:
http://api.example.com/item/ [{{ItemID}} [/{{Property}}]]
The following requests should all be valid:
http://api.example.com/item
http://api.example.com/item/
http://api.example.com/item/1
http://api.example.com/item/1/
http://api.example.com/item/1/description
http://api.example.com/item/1/description/
I need to be able to get the ItemID and Property values, if they exist.
I attempted to use Apache Commons StringUtils and the substringBefore/substringAfter, but things soon got confusing. Is there a library for such a task, or another way I overlooked?