users@jersey.java.net

client - custom headers

From: Chase Seibert <chase_at_bullhorn.com>
Date: Thu, 11 Dec 2008 12:30:48 -0500

I'm not able to get the client API to send a custom header item. My sample
code looks like:

            ClientConfig clientConfig = new DefaultClientConfig();
            Client client = Client.create(clientConfig);
            WebResource webResource = client.resource("http://localhost:8888
");
            webResource.accept("application/xml");
            webResource.header("header", "value");
            webResource.post(String.class, "body");

When I put a proxy up at localhost:8080, this is the request I see:

POST / HTTP/1.1
User-Agent: Java/1.6.0_01
Host: localhost
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
Content-Length: 4

body

Ie, no custom header. I'm using Jersey 1.0.1. Thanks,

   -Chase