What it says in the title.
I want to serve a root resource that consists only of links to the "lower" resources. It seems that Resource
as well as HttpEntity
want an object with some content as their type, so how can I serve just Links?
Thanks.
What it says in the title.
I want to serve a root resource that consists only of links to the "lower" resources. It seems that Resource
as well as HttpEntity
want an object with some content as their type, so how can I serve just Links?
Thanks.
So what you conceptually do is returning an empty collection resource with links attached. This can be achieved by this snippet of code:
List<Link> links = …
return new Resources<Object>(Collections.emptySet(), links);
I couldn't figure out which "Resources" that was and I wanted to return a proper HAL representation in order to make use of "/" as the entry point in HAL Explorer. This worked out for me:
return ResponseEntity.ok(new RepresentationModel<>()
.add(linkTo(methodOn(SomeController.class).GET()).withRel("some-rel")));
© 2022 - 2024 — McMap. All rights reserved.