Reputation: 12146
If request URIs I can get are http://file/first_dir/second_dir/file.txt
, is there a way to put everything after http://file
into a variable/method argument like it is possible with @PathVariable
?
Upvotes: 0
Views: 1061
Reputation: 28519
its a confusing URL, file is usually a protocol, so its easy to get confused. Anyways, the problem is that the path variable separator is set to "/" and you can't "beat" this with a regex inside a request mapping. So one way would be to go for a custom mapper, here's a DZone article describing a custom mapper for optional path variables
http://java.dzone.com/articles/spring-3-webmvc-optional-path
But if I were you, I would give this solution a try, Spring MVC Getting PathVariables containing dots and slashes it uses a regex inside a rewrite filter to catch a sequence, and posts it as a parameter. I think it can provide a viable solution for you
Upvotes: 1