toggle quoted messageShow quoted text
first of all, I would recommend upgrading to supported Jersey 2.x.
Jersey 1.x client contained similar class ClientFilter, and one can get the uri from ClientRequest#getUri.
You may also use ContainerResponseFilter to set a HTTP header on a server with base uri (ContainerResponse#getHttpHeaders is mutable)
On 26.06.2018 22:03, Martynas wrote:
just to make sure - it’s not possible in 1.x?
On Tue, 26 Jun 2018 at 11.29, Martynas <@namedgraph <mailto:@namedgraph>> wrote:
Thanks, it looks promising indeed! I guess I will need to upgrade
to 2.x :)
On Tue, Jun 26, 2018 at 11:16 AM, Jan Supol <jan.supol@...
does ClientRequestContext#getUri help you?
On 25.06.2018 22:53, Martynas wrote:
suppose I am writing a MessageBodyReader (on Jersey 1.19)
and I add register it in ClientConfig for use in the Client.
Is there any way to inject or otherwise supply the URI of
the response being read? It is required in some cases to
properly read the entity, for example baseUri in
Jsoup.parse(InputStream in, String charsetName, String
MessageBodyReader.readFrom() supplies media type, HTTP
headers and entity stream. As far as I know, no response
header provides the response URI, other than Location in
case of redirect, so no luck there.
On the server side this is not a problem as one can inject
UriInfo, but I'm interested in the use with Client.
I could pass the baseUri into the
MessageBodyReader implementation constructor, but I don't
want to be creating a provider with each read, and anyway
I don't see to a way to register it on a WebResource
rather than Client/ClientConfig.
Is there a way to solve this in 1.x or 2.x or is my
atomgraph.com <http://atomgraph.com> <http://atomgraph.com>