Is there a way to get the complete path value after the requestMapping
@PathVariable
values have been parsed?
That is:
/{id}/{restOfTheUrl}
should be able to parse /1/dir1/dir2/file.html
into id=1
and restOfTheUrl=/dir1/dir2/file.html
Any ideas would be appreciated.
I have used the Tuckey URLRewriteFilter to handle path elements that contain '/' characters, as I don't think Spring 3 MVC supports them yet.
http://www.tuckey.org/
You put this filter in to your app, and provide an XML config file. In that file you provide rewrite rules, which you can use to translate path elements containing '/' characters into request parameters that Spring MVC can deal with properly using @RequestParam.
WEB-INF/web.xml:
WEB-INF/urlrewrite.xml:
Controller method:
Non-matched part of the URL is exposed as a request attribute named
HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
:This has been here quite a while but posting this. Might be useful for someone.
You need to use built-in
pathMatcher
:Yes the
restOfTheUrl
is not returning only required value but we can get the value by usingUriTemplate
matching.I have solved the problem, so here the working solution for the problem: