I need to migrate our spring boot application to Quarkus. Facing the issue of how to implement the hateoas in Quarkus. Any suggestions are welcome.
Spring boot code:
import org.springframework.hateoas.Link;
import org.springframework.hateoas.server.mvc.ControllerLinkBuilder;
public String getHref(ProductOfferApiRequest productOfferApiRequest) {
Link link = ControllerLinkBuilder
.linkTo(ProductOfferingController.class)
.slash("getProductOrderService")
.slash(productOfferApiRequest.getRequestHeader().getOrderID())
.slash(productOfferApiRequest.getRequestHeader().getSessionID())
.withSelfRel();
return link.getHref();
return null;
Looking similar solution in Quarkus.
For Quarkus RESTEASY Reactive extension, you can also use the dependency "quarkus-resteasy-reactive-links" which gives you support for Web links (hateoas). See the official documentation about this dependency.
If what you're looking for, it's to programmatically access the generated links, then you would need to inject the RestLinksProvider as:
And then use the
getTypeLinks(class)orgetInstanceLinks(instance)to search for the links.Instead, if what you're looking for, it's to manually generate the links yourself (you want to use the provided
@InjectRestLinksand@RestLinkannotations as described in the documentation), then you can build the links yourself as follows:Note that the
Linkclass is a builder with lots of options.I hope it helps!