users@jersey.java.net

Re: [Jersey] Jesey Oauth client and “%20” spaces

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 03 Feb 2010 07:48:32 +0100

On Feb 2, 2010, at 11:13 PM, Hubert Le Van Gong wrote:

> This bug is now fixed (see detail below).

Thanks!

Paul.

> Please, let us know if there's any other issue.
>
>
> Cheers,
> Hubert
>
>
>> Date: 2 Feb 2010 16:56:22 -0000
>> From: hlevangong <hlevangong_at_dev.java.net>
>> Content-type: text/plain; charset=UTF-8
>> Subject: [Issue 433] OAuth signature calculation incorrect if
>> parameters contain charact
>>
>> https://jersey.dev.java.net/issues/show_bug.cgi?id=433
>>
>>
>>
>> User hlevangong changed the following:
>>
>> What |Old value |New value
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> Status|NEW |RESOLVED
>> --------------------------------------------------------------------------------
>> Resolution| |FIXED
>> --------------------------------------------------------------------------------
>>
>>
>>
>>
>> ------- Additional comments from hlevangong_at_dev.java.net Tue Feb 2
>> 16:56:21 +0000 2010 -------
>> We leveraged the Jersey UriComponent class to encode the various
>> elements of the signature base string
>> (had to stretch its use a bit since creating that base string
>> amounts to re-encode an encoded URI...).
>> This fix removes the need for a specific encoding class (former
>> URLCodec).
>>
>> I also added the proposed twitter test case in the SignatureCase
>> class.
>>
>> The OAuth Client and Server classes have been very slightly
>> modified (getRequestURL() method returns a URL
>> and not a String).
>>
>> Hubert
>>
>
>
>
> On Jan 27, 2010, at 9:02 AM, Paul Sandoz wrote:
>
>>
>> On Jan 26, 2010, at 8:42 PM, masonh wrote:
>>
>>> OK...thanks for that info. Any idea on where that bug report
>>> might be? I can't seem to find it.
>>>
>>
>> https://jersey.dev.java.net/issues/show_bug.cgi?id=433
>>
>> Paul.
>>
>>> On Mon, Jan 25, 2010 at 8:39 PM, Suneel Marthi [via Jersey]
>>> <[hidden email]> wrote:
>>> I think this was a bug in Jersey Oauth implementation that was to
>>> be fixed.
>>> This was posted by another user 2 months ago.
>>>
>>>
>>> ----- Original Message ----
>>> From: masonh <[hidden email]>
>>> To: [hidden email]
>>> Sent: Mon, January 25, 2010 4:42:57 PM
>>> Subject: [Jersey] Jesey Oauth client and “%20” spaces
>>>
>>>
>>> HI all. I am trying to use the Sun Jersey Client API with Jesey
>>> Oauth to
>>> connect to twitter. Lets say I already have the oauth token and
>>> token
>>> secret.
>>>
>>> String accessToken = MY_TOKEN;
>>> String accessTokenSecret = MY_TOKEN_SECRET;
>>> String url = "http://twitter.com/statuses/update.xml";
>>>
>>> // initialize the params and secret.
>>> OAuthParameters params = initOAuthParams();
>>> params.token(accessToken);
>>> OAuthSecrets secrets = initOAuthSecrets();
>>> secrets.tokenSecret(accessTokenSecret);
>>>
>>> // now access the resource
>>> OAuthClientFilter filter = getClientFilter(params, secrets);
>>> WebResource resource = client.resource(url);
>>> resource.addFilter(filter);
>>>
>>> MultivaluedMapImpl form = new MultivaluedMapImpl();
>>> String status = new String("test with spaces");
>>> form.add("status", status);
>>>
>>> // post it
>>> resource.type("application/x-www-form-
>>> urlencoded").post(String.class,
>>> form);
>>>
>>> This code will work, but the spaces are encoded as "+". That
>>> would normally
>>> be fine, but Twitter seems to only take "%20". if I try replacing
>>> the post
>>> with
>>>
>>> resource.type("application/x-www-form-
>>> urlencoded").post(String.class,
>>> "status=test with spaces");
>>> or
>>> resource.type("application/x-www-form-
>>> urlencoded").post(String.class,
>>> "status=test%20with%20spaces");
>>>
>>> twitter will respond with a 401, Incorrect Signature. If I try just
>>>
>>> resource.type("application/x-www-form-
>>> urlencoded").post(String.class,
>>> "status=test");
>>>
>>> twitter will accept it. How can I get Oauth to work with spaces
>>> encoded as
>>> "%20"?
>>>
>>> Thanks!
>>> Mason
>>> --
>>> View this message in context: http://n2.nabble.com/Jesey-Oauth-client-and-20-spaces-tp4456943p4456943.html
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>>
>>> View this message in context: Re: [Jersey] Jesey Oauth client and
>>> “%20” spaces
>>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>
> --
> Hubert A. Le Van Gong
> Identity Architect
> Sun microsystems, Inc.
>
>
> 17 Rue Duprey
> Grenoble, 38000
> France
>
> --------------------------------------------------
> email: hubert.levangong_at_sun.COM
> tel:+33 4 7663 0935
> blog: http://blog.levangong.com/
>
> N 45 11.900'
> W 005 44.145'
> Elev. 736 ft.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>