There is a task to pass file path as @PathVariable
in Spring MVC to REST Service with GET
request.
We can easily do it with POST
sending String of file path in JSON.
How we can do with GET
request and @Controller
like this?
@RequestMapping(value = "/getFile", method = RequestMethod.GET)
public File getFile(@PathVariable String path) {
// do something
}
Request:
GET /file/getFile/"/Users/user/someSourceFolder/8.jpeg"
Content-Type: application/json