title: How to get a path variable that is the remainder of the path in Spring MVC?
body: <p>How can I get my last path variable to be the remaining path? I have something like this, but it's not getting hit:</p>
  
  <pre><code>@RequestMapping(value = "{storageId}/{repositoryId}/{path}/**",
                  method = RequestMethod.PUT)
  @RequestMapping(value = "{storageId}/{repositoryId}/{path}/**", method = RequestMethod.PUT)
  public ResponseEntity upload(@PathVariable(name = "storageId") String storageId,
                               @PathVariable(name = "repositoryId") String repositoryId,
                               @PathVariable(name = "path") String path,
                               MultipartFile multipartFile)
          throws ...
  {
     ...
  }
  </code></pre>
  
  <p>In Jersey, I could do it easily like this:</p>
  
  <pre><code>@Path("{storageId}/{repositoryId}/{path:.*}")
  </code></pre>
  
  <p>... but I have to migrate some code over to Spring MVC.</p>
  
  <p>The problem is that if my URL is:</p>
  
  <pre><code>http://localhost:48080/storages/storage0/snapshots/org/foo/bar/metadata/metadata-foo/3.1-SNAPSHOT/metadata-foo-3.1-20161017.182007-1.jar
  </code></pre>
  
  <p>my <code>path</code> gets truncated to:</p>
  
  <pre><code>metadata/metadata-foo/3.1-SNAPSHOT/metadata-foo-3.1-20161017.182007-1.jar
  </code></pre>
  
  <p>Which is obviously incorrect, as it should be:</p>
  
  <pre><code>org/foo/bar/metadata/metadata-foo/3.1-SNAPSHOT/metadata-foo-3.1-20161017.182007-1.jar
  </code></pre>
  
  <p>Any advice would be welcome!</p>