Send file path as @PathVariable in Spring MVC
<p>There is a task to pass file path as <code>@PathVariable</code> in Spring MVC to REST Service with <code>GET</code> request.</p>

<p>We can easily do it with <code>POST</code> sending String of file path in JSON.</p>

<p>How we can do with <code>GET</code> request and <code>@Controller</code> like this?</p>

<pre><code>@RequestMapping(value = "/getFile", method = RequestMethod.GET)
public File getFile(@PathVariable String path) {
    // do something
}
</code></pre>

<p>Request:</p>

<pre><code>GET /file/getFile/"/Users/user/someSourceFolder/8.jpeg"
Content-Type: application/json
</code></pre>