I\'m working on a webapp, one function of which was to list all the files under given path. I tried to map several segments of URL to one PathVariable like this :
In REST each URL is a separate resource, so I don't think you can have a generic solution. I can think of two options
@RequestMapping("/list/**")
(path
parameter no longer needed) and extract the whole path from request@RequestMapping("/list/{level1}")
, @RequestMapping("/list/{level1}/{level2}")
, @RequestMapping("/list/{level1}/{level2}/{level3}")
... concatenate the path in method bodies and call one method that does the job. This, of course, has a downside that you can only support a limited folder depth (you can make a dozen methods with these mappings if it's not too ugly for you)