Remove the few remaining usages of UriTemplate

Also update Javadoc of UriTemplate to point to UriComponentsBuilder and
UriBuilderFactory as more flexible options.

See gh-24094
This commit is contained in:
Rossen Stoyanchev
2019-11-28 11:28:49 +00:00
parent df2ed75df0
commit b44daa8b71
7 changed files with 38 additions and 29 deletions

View File

@@ -22,7 +22,8 @@ import java.util.Map;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.ui.ModelMap;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.UriTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
/**
* Dummy request context used for FreeMarker macro tests.
@@ -107,8 +108,8 @@ public class DummyMacroRequestContext {
* @see org.springframework.web.reactive.result.view.RequestContext#getContextUrl(String, Map)
*/
public String getContextUrl(String relativeUrl, Map<String,String> params) {
UriTemplate template = new UriTemplate(relativeUrl);
return getContextPath() + template.expand(params).toASCIIString();
UriComponents uric = UriComponentsBuilder.fromUriString(relativeUrl).buildAndExpand(params);
return getContextPath() + uric.toUri().toASCIIString();
}
/**