Fix for encoding issue with MvcUriComponentsBuilder
Provide method for stronger encoding of expanded URI variables when building links from views. Issue: SPR-17027
This commit is contained in:
@@ -402,6 +402,20 @@ public class MvcUriComponentsBuilderTests {
|
||||
assertEquals("http://example.org:9999/base/people/123/addresses/DE", url);
|
||||
}
|
||||
|
||||
@Test // SPR-17027
|
||||
public void fromMappingNameWithEncoding() {
|
||||
|
||||
initWebApplicationContext(WebConfig.class);
|
||||
|
||||
this.request.setServerName("example.org");
|
||||
this.request.setServerPort(9999);
|
||||
this.request.setContextPath("/base");
|
||||
|
||||
String mappingName = "PAC#getAddressesForCountry";
|
||||
String url = fromMappingName(mappingName).arg(0, "DE;FR").encode().buildAndExpand("_+_");
|
||||
assertEquals("/base/people/_%2B_/addresses/DE%3BFR", url);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fromControllerWithPrefix() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user