Hello sohit224,
you can do this:
Client c = Client.create();
WebResource w = c.resource("
http://host/path");
String s = w.header("name", "value").get(String.class);
or you can use client filter as well:
Client c = Client.create();
c.addFilter(new ClientFilter() {
@Override
public ClientResponse handle(ClientRequest cr) throws
ClientHandlerException {
cr.getHeaders(); // do what you want
return getNext().handle(cr);
}
});
Please see jersey user guide:
http://jersey.java.net/nonav/documentation/latest/client-api.html
Regards,
Pavel
On 02/16/2011 02:43 PM, sohit224 wrote:
> I am using jersey client and I need to add a new property in the request
> header.
>
> I tried adding the headers using
> 1) ClientConfig config = new DefaultClientConfig();
> config.getProperties().put(key, value);
> 2) Adding client Filter
>
> How can we add new properties to the request header using jersey client.
>
>
>
>