diff options
Diffstat (limited to 'src/io/OAuthRequester.java')
-rw-r--r-- | src/io/OAuthRequester.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/io/OAuthRequester.java b/src/io/OAuthRequester.java index b4ac481..77c41c0 100644 --- a/src/io/OAuthRequester.java +++ b/src/io/OAuthRequester.java @@ -1,12 +1,17 @@ package io; import java.io.IOException; +import java.net.HttpURLConnection; import java.net.URLConnection; import oauth.signpost.OAuth; import oauth.signpost.OAuthConsumer; import oauth.signpost.basic.DefaultOAuthConsumer; import oauth.signpost.basic.DefaultOAuthProvider; +import oauth.signpost.basic.HttpURLConnectionRequestAdapter; +import oauth.signpost.exception.OAuthCommunicationException; import oauth.signpost.exception.OAuthException; +import oauth.signpost.exception.OAuthExpectationFailedException; +import oauth.signpost.exception.OAuthMessageSignerException; import org.json.JSONObject; import support.ConsumerKeySecret; import support.OAuthAccessTokenSecret; @@ -92,6 +97,21 @@ public class OAuthRequester extends AbstractRequester { } } + /** + * Signs a HTTP request. + * + * @param conn An open HTTP connection with data ready to be sent. + * @throws OAuthMessageSignerException + * @throws OAuthExpectationFailedException + * @throws OAuthCommunicationException + */ + public void sign(HttpURLConnection conn) throws OAuthMessageSignerException, + OAuthExpectationFailedException, OAuthCommunicationException { + HttpURLConnectionRequestAdapter request; + request = new HttpURLConnectionRequestAdapter(conn); + consumer.sign(request); + } + @Override protected void preconnect(URLConnection conn) throws IOException { try { |