I have a spring application that stores objects and attributes, and provides paths to access them, in the form /application-root/{object}/{attribute}.
A new change is to allow objects to contain child objects within attributes. A user should be able to access data with a path like this:
/application-root/{object1}/{attribute1}/{object2}/{attribute2}/{object3}/{attribute3}...
There is no hard limit on how deep an object can be nested, so I need to be able to handle a path with a variable number of segments and extract the information from the objects and attributes from it.
I've looked at the regular expressions in PathPattern class, but it looks like it that regex will only match a single segment.
What's the best way to handle a variable number of path segments in Spring?