John, thanks very much for the tip.  I've done as you suggested and
created a class that's a patched version of HttpClient3 that allows
the cookie policy to be set.

I use it like this:

OAuthAccessor oAuthAccessor = new OAuthAccessor(new
OAuthConsumer(null, key, secret, null));
PatchedHttpClient3 httpClient3 = new PatchedHttpClient3();
httpClient3.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
OAuthClient oAuthClient = new OAuthClient(httpClient3);
OAuthResponseMessage oAuthResponseMessage =
   oAuthClient.access(oAuthAccessor.newRequestMessage(HttpClient.GET,
   "http://twitter.com/statuses/home_timeline.xml";,
   parameters.entrySet()), ParameterStyle.AUTHORIZATION_HEADER);

Here is the patched HttpClient3 .java file:
http://dl.dropbox.com/u/3414849/PatchedHttpClient3.java

Thanks,
Jonathan

On Jul 14, 11:31 pm, John Kristian <[email protected]> wrote:
> You can create a class that implements net.oauth.http.HttpClient and
> sets the cookie policy in its execute method.  You could start with
> the source code of HttpClient3 or HttpClient4 from the library, modify
> it to do what's needed and use the new class in place of the library
> class on which it's based.
>
> It would be good for the library classes to do this if an optional
> httpParameter is set, I think.  I'll put it on my list of things to
> implement.  A patch with a test case would be welcome.
>
> On Jul 3, 7:40 pm, Jonathan Abrams <[email protected]> wrote:
>
> > I'm using the standard (Netflix-originated) Java OAuth library, and
> > I'd like to stop getting these cookie errors:
>
> > WARNING: Cookie rejected: "$Version=0;
> > k=67.180.49.19.1278208002887301; $Path=/;
> >  $Domain=.twitter.com". Illegal domain attribute ".twitter.com".
> > Domain of origi
> > n: "twitter.com"
>
> > I'd like to call setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY)
> > to stop these warnings, but I can't see how I can gain access to the
> > HTTPClient method's params so that I can use setCookiePolicy().
>
> > Is there a way to use setCookiePolicy() with the Java OAuth library?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"OAuth" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/oauth?hl=en.

Reply via email to