I want my response to include this:
\"keyMaps\":{
\"href\":\"http://localhost/api/keyMaps{/keyMapId}\",
\"templated\":true
}
That\'s easy
According to this issue comment, this will be addressed in an upcoming release of spring-hateoas.
For now, there's a drop-in replacement for ControllerLinkBuilder
available from de.escalon.hypermedia:spring-hateoas-ext
in Maven Central.
I can now do this:
import static de.escalon.hypermedia.spring.AffordanceBuilder.*
...
add(linkTo(methodOn(KeyMapController.class).getKeyMap(null)).withRel("keyMaps"));
I pass in null
as the parameter value to indicate I want to use a template variable. The name of the variable is automatically pulled from the controller.