Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 0.98 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Removing oauth_token from request header in Scribe
  2. public class TestImporter {
  3.  
  4.   private static final String REQ_URL   = "http://test.com/";
  5.  
  6.   private static final String KEY         = "KEY";
  7.   private static final String SECRET      = "SECRET";
  8.  
  9.   // test variables
  10.   private static final String VAR1        = "Test123";
  11.  
  12.   public static void main(String[] args) {
  13.  
  14.     OAuthService service = new ServiceBuilder()
  15.                                .provider(TestAPI.class)
  16.                                .apiKey(KEY)
  17.                                .apiSecret(SECRET)
  18.                                .build();
  19.     Token token = new Token("", "");
  20.     OAuthRequest request = new OAuthRequest(Verb.GET, REQ_URL + VAR1 + "/");
  21.     service.signRequest(token, request);
  22.     Response response = request.send();
  23.     System.out.println(response.getBody());
  24.  
  25.   }
  26.  
  27. }
  28.        
  29. ServiceBuilder()
  30.   .provider(TestAPI.class)
  31.   .apiKey(KEY)
  32.   .apiSecret(SECRET)
  33.   .signatureType(SignatureType.QueryString)
  34.   .build();