cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: REST WebClient: how to inspect and set eTag headers?
Date Mon, 16 Jan 2012 12:34:57 GMT
Hi Guy

On 15/01/12 16:01, Guy Pardon wrote:
> Hi,
>
> I want to inspect eTag headers in responses from a REST service, to set them on later
PUT requests. Any guidelines on how to do this with the CXF WebClient API?

You can do something like this:

Book book = webClient.get(Book.class);
Object header = webClient.getResponse().getMetadata().getFirst("ETag");
if (header != null) {
    EntityTag eTag = EntityTag.fromString(header);
    ...
}

In JAX-RS 2.0 it will be easier to deal with Response headers.

and then

webClient.header("If-None-Match", eTag);
etc...

Cheers, Sergey


>
> Thanks
> Guy

Mime
View raw message