Ignore path parameters in request mappings

Before this change the presence of path params (e.g. "/foo;q=1/bar")
expected the request mapping to contain a URI variable in the place of
semicolon content (e.g. either "/{foo}/bar" or "/{foo};{fooParams}").

The change ensures path params are ignored in @RequestMapping patterns
so that "/foo/bar" matches to "/foo;q=1/bar" as well as
"/foo;q=1;p=2/bar".

Along with this change, the RequestMappingHandlerMapping no longer
defaults to having semicolon content removed from the URL, which means
@MatrixVariable is supported by default without the need for any
further configuration.

Issue: SPR-10234
This commit is contained in:
Rossen Stoyanchev
2013-02-15 11:31:32 -05:00
parent eda53ec1d8
commit 5b1165b102
8 changed files with 42 additions and 22 deletions

View File

@@ -441,10 +441,8 @@ public class UrlPathHelper {
* @return the updated URI string
*/
public String removeSemicolonContent(String requestUri) {
if (this.removeSemicolonContent) {
return removeSemicolonContentInternal(requestUri);
}
return removeJsessionid(requestUri);
return this.removeSemicolonContent ?
removeSemicolonContentInternal(requestUri) : removeJsessionid(requestUri);
}
private String removeSemicolonContentInternal(String requestUri) {