I am trying to add links to my jax-rs response headers:
Link.fromMethod(UserResource.class, "delete")
.baseUri(getUriInfo().getBaseUri()).rel("delete").build(id);
While i see in per debugger and log that getUriInfo().getBaseUri()
returns the correct uri, the resulting link is only /1
(for id=1).
Using UriBuilder it is working!
URI build = getUriInfo().getBaseUriBuilder().path(UserResource.class, "delete").build(id);
Link.fromUri(build).rel("delete").build();
getUriInfo
just returns uriInfo from base class injected with @Context
.
So how to get it working with Link (it should work, shouldn't it)?
This worked for me:
cloning because I re use the builder