Reputation: 1
I have this @RequestMapping(value = "/image/{path}",method = RequestMethod.GET)
in my controller
I need {path}
variable in some different ways for example : path could be "image.png" in other time could be "/resources/images/image.png"..
My question: Can spring handle variable like paths --> "/resources/images/image.png"
?
Upvotes: 0
Views: 830
Reputation: 976
/
and .
will break the variable into pieces. Using the path variables without any additional configurations you have to break even the file name into two separate path variables like
@RequestMapping(value = "/image/{filename}/{extension}", method = RequestMethod.GET)
public [ReturnType] myMethod(
@PathVariable("filename") String file,
@PathVariable("extension") String ext) { ... }
Upvotes: 1