users@jersey.java.net

Re: [Jersey] [Client API] How to obtain ETag and LastModified of received entity?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 26 Aug 2008 08:42:47 +0200

On Aug 25, 2008, at 6:51 PM, Markus KARG wrote:

> Paul,
>>> Currently I am doing this:
>>>
>>> Client client = Client.create();
>>> WebResource r = client.resource("http://192.168.0.15:8080/
>>> JaxRsSample/sample/Test%201%20/%201.article");
>>> String entity = r.get(String.class);
>>>
>>> How to find out the ETag and LastModified of this result?
>> ClientResponse cr = r.get(ClientResponse.class);
>> String entity = cr.getEntity(String.class);
>> EntityTag et = cr.getEntityTag();
>> Date lm = cr.getLastModified();
> Cool, that is really great! It works very well!
>
> Thanks for this code snippet! :-)
>
> I wonder why there is no "getVia()" or "getCacheControl()" to find
> out more details on the response that might be needed by the
> application?
>

An oversight on my part. This may have to wait until after the 1.0
release to add this and other methods.

Paul.

> Regards
> Markus
>
> --
> http://www.xing.com/go/invita/58469
>