I'm implementing a ContainerResponseFilter
that would add hypermedia links to the response.
The method signature in the ContainerResponseFilter
is:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException
Unfortunately ContainerResponseContext
does not allow me to set a Response
object, and while there are getLinks()
methods, there are not addLink(Link)
or setLinks(Link...)
methods.
I tried
responseContext.setEntity(Response.ok().links(link).build());
but that resulted in an exception that said they could find a MessageBodyWriter
for ResponseImpl
. Also tried
responseContext.getLinks().add(link);
which doesn not work either.
Anyone ever done this?