java - OAuth with Signpost and Apache Commons HTTP -
so i'm working signpost oauth library java. i'm running complications using apache commons http library it. take @ following code:
url url = new url("http://api.neoseeker.com/forum/get_pm_counts.json"); httprequest request = (httprequest) url.openconnection(); consumer.sign(request); request.connect(); system.out.println("response: " + request.getresponsecode() + " " + request.getresponsemessage());
this taking this example. can see request
used httpurlconnection
, because i'll using apache commons http library, changed httprequest
object. now, i'm getting errors when call connect()
, getresponsecode()
, , getresponsemessage()
, because functions httpurlconnection
. functions httprequest
use can code compile , run correctly? thanks!
signpost has seperate module using apache's http client. need use commonshttpoauthconsumer this.
this module lives here - http://code.google.com/p/oauth-signpost/downloads/detail?name=signpost-commonshttp4-1.2.1.1.jar&can=2&q=
some sample code use here - http://code.google.com/p/oauth-signpost/wiki/apachecommonshttp4, comes down instantiating commonshttpoauthconsumer instead of normal one...
if use maven, coordinates here, couldn't find them documented anywhere when trying figure out...
<dependency> <groupid>oauth.signpost</groupid> <artifactid>signpost-commonshttp4</artifactid> <version>1.2.1.1</version> </dependency>
Comments
Post a Comment