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:
@@ -868,14 +868,24 @@ public class MvcUriComponentsBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method only if you need to apply strong encoding to expanded
|
||||
* URI variables by quoting all characters with reserved meaning.
|
||||
* @since 5.0.8
|
||||
*/
|
||||
public MethodArgumentBuilder encode() {
|
||||
this.baseUrl.encode();
|
||||
return this;
|
||||
}
|
||||
|
||||
public String build() {
|
||||
return fromMethodInternal(this.baseUrl, this.controllerType, this.method, this.argumentValues)
|
||||
.build(false).encode().toUriString();
|
||||
.build().encode().toUriString();
|
||||
}
|
||||
|
||||
public String buildAndExpand(Object... uriVars) {
|
||||
return fromMethodInternal(this.baseUrl, this.controllerType, this.method, this.argumentValues)
|
||||
.build(false).expand(uriVars).encode().toString();
|
||||
.buildAndExpand(uriVars).encode().toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user