users@jersey.java.net

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

From: masonh <mason.harding_at_gmail.com>
Date: Tue, 26 Jan 2010 11:42:44 -0800 (PST)

OK...thanks for that info. Any idea on where that bug report might be? I
can't seem to find it.

On Mon, Jan 25, 2010 at 8:39 PM, Suneel Marthi [via Jersey] <
ml-node+4458674-1515118234_at_n2.nabble.com<ml-node%2B4458674-1515118234_at_n2.nabble.com>
> 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]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=0>>
>
> To: [hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=1>
> 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]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=2>
> For additional commands, e-mail: [hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=3>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=4>
> For additional commands, e-mail: [hidden email]<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4458674&i=5>
>
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/Jesey-Oauth-client-and-20-spaces-tp4456943p4458674.html
> To unsubscribe from Jesey Oauth client and “%20” spaces, click here< (link removed) >.
>
>
>

-- 
View this message in context: http://n2.nabble.com/Jesey-Oauth-client-and-20-spaces-tp4456943p4462839.html
Sent from the Jersey mailing list archive at Nabble.com.