users@jersey.java.net

Re: [Jersey] HowTo get HTTP Header from a POST response?

From: Markus Kolb <java-sun_at_tower-net.de>
Date: Tue, 20 May 2008 20:00:13 +0200

Paul Sandoz wrote on 2008-05-19 10:14:
> Hi Markus,
>
> What version of Jersey are you using? With 0.6 or greater you can do this:
>
> ClientResponse cr = r.post(ClientResponse.class, "content");
> String h = cr.getMetadata().getFirst("X-My-Header");
> String e = cr.getEntity(String.class);
>
> When you utilize ClientResponse you will need to explicitly check the
> status code for errors (unless you write a ClientFilter that checks and
> throws an exception).
>
> Paul.

Hi Paul,

thank you. Got it to work ;-)