spring-framework / org.springframework.web.util / UriTemplate / expand

expand

open fun expand(uriVariables: MutableMap<String, *>): URI

Given the Map of variables, expands this template into a URI. The Map keys represent variable names, the Map values variable values. The order of variables is not significant.

Example:

 UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}"); Map<String, String> uriVariables = new HashMap<String, String>(); uriVariables.put("booking", "42"); uriVariables.put("hotel", "Rest & Relax"); System.out.println(template.expand(uriVariables)); 
will print: http://example.com/hotels/Rest%20%26%20Relax/bookings/42

Parameters

uriVariables - the map of URI variables

Exceptions

IllegalArgumentException - if uriVariables is null; or if it does not contain values for all the variable names

Return
the expanded URI

open fun expand(vararg uriVariableValues: Any): URI

Given an array of variables, expand this template into a full URI. The array represent variable values. The order of variables is significant.

Example:

 UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}"); System.out.println(template.expand("Rest & Relax", 42)); 
will print: http://example.com/hotels/Rest%20%26%20Relax/bookings/42

Parameters

uriVariableValues - the array of URI variables

Exceptions

IllegalArgumentException - if uriVariables is null or if it does not contain sufficient variables

Return
the expanded URI