dev@jersey.java.net

How to set cookie policy using jersey client

From: Srikanth Martha <srikanth.martha_at_gmail.com>
Date: Fri, 27 Aug 2010 11:45:46 -0700

I have the following code

       DefaultApacheHttpClientConfig apcc = new
DefaultApacheHttpClientConfig();

apcc.getProperties().put(DefaultApacheHttpClientConfig.PROPERTY_HANDLE_COOKIES,
true);
        apcc.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS,
false);
        apcc.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT,
10*1000);
        apcc.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT,
30*1000);

        ApacheHttpClient jerseyClient = ApacheHttpClient.create(apcc);

        WebResource r = novaResource.path("some_path");
            NovaWorkflowBean response = r.accept(MediaType.APPLICATION_JSON)
                                        .cookie(ybyCookie)
                                        .get(MyBean.class);

whenever I make webservices calls using the above , I see the following logs
which I would like to ignore by setting the equivalent of
CookiePolicy.BROWSER_COMPATIBILITY in HttpClient.

2010-08-13 20:40:13,063 WARN org.apache.commons.httpclient.HttpMethodBase -
Cookie rejected: "$Version=0; B=atae73l66bbdd&b=3&s=ca; $Path=/;
$Domain=.xxxx". Domain attr
ibute "xxx" violates RFC 2109: host minus domain may not contain any dots
2010-08-13 20:40:13,218 WARN org.apache.commons.httpclient.HttpMethodBase -
Cookie rejected: "$Version=0; B=chns9n566bbdd&b=3&s=79; $Path=/;
$Domain=xxx". Domain attr
ibute "xxx" violates RFC 2109: host minus domain may not contain any dots

How do I achieve that.

Thanks
--Sreekanth