Package com.github.scribejava.core.oauth
Class OAuthService
- java.lang.Object
-
- com.github.scribejava.core.oauth.OAuthService
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
OAuth10aService,OAuth20Service
public abstract class OAuthService extends java.lang.Object implements java.io.Closeable
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringapiKeyprivate java.lang.StringapiSecretprivate java.lang.Stringcallbackprivate java.io.OutputStreamdebugStreamprivate HttpClienthttpClientprivate java.lang.StringuserAgent
-
Constructor Summary
Constructors Constructor Description OAuthService(java.lang.String apiKey, java.lang.String apiSecret, java.lang.String callback, java.io.OutputStream debugStream, java.lang.String userAgent, HttpClientConfig httpClientConfig, HttpClient httpClient)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Responseexecute(OAuthRequest request)java.util.concurrent.Future<Response>execute(OAuthRequest request, OAuthAsyncRequestCallback<Response> callback)<R> java.util.concurrent.Future<R>execute(OAuthRequest request, OAuthAsyncRequestCallback<R> callback, OAuthRequest.ResponseConverter<R> converter)java.util.concurrent.Future<Response>executeAsync(OAuthRequest request)java.lang.StringgetApiKey()java.lang.StringgetApiSecret()java.lang.StringgetCallback()private static HttpClientgetClient(HttpClientConfig config)abstract java.lang.StringgetVersion()Returns the OAuth version of the service.protected booleanisDebug()voidlog(java.lang.String message)No need to wrap usages inisDebug().voidlog(java.lang.String messagePattern, java.lang.Object... params)Wrap usages inisDebug().
-
-
-
Field Detail
-
apiKey
private final java.lang.String apiKey
-
apiSecret
private final java.lang.String apiSecret
-
callback
private final java.lang.String callback
-
userAgent
private final java.lang.String userAgent
-
httpClient
private final HttpClient httpClient
-
debugStream
private final java.io.OutputStream debugStream
-
-
Constructor Detail
-
OAuthService
public OAuthService(java.lang.String apiKey, java.lang.String apiSecret, java.lang.String callback, java.io.OutputStream debugStream, java.lang.String userAgent, HttpClientConfig httpClientConfig, HttpClient httpClient)
-
-
Method Detail
-
getClient
private static HttpClient getClient(HttpClientConfig config)
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getApiKey
public java.lang.String getApiKey()
-
getApiSecret
public java.lang.String getApiSecret()
-
getCallback
public java.lang.String getCallback()
-
getVersion
public abstract java.lang.String getVersion()
Returns the OAuth version of the service.- Returns:
- OAuth version as string
-
executeAsync
public java.util.concurrent.Future<Response> executeAsync(OAuthRequest request)
-
execute
public java.util.concurrent.Future<Response> execute(OAuthRequest request, OAuthAsyncRequestCallback<Response> callback)
-
execute
public <R> java.util.concurrent.Future<R> execute(OAuthRequest request, OAuthAsyncRequestCallback<R> callback, OAuthRequest.ResponseConverter<R> converter)
-
execute
public Response execute(OAuthRequest request) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.io.IOException
-
log
public void log(java.lang.String message)
No need to wrap usages inisDebug().- Parameters:
message- message to log
-
log
public void log(java.lang.String messagePattern, java.lang.Object... params)Wrap usages inisDebug(). It was made for optimization - to not calculate "params" in production mode.- Parameters:
messagePattern- messagePatternparams- params
-
isDebug
protected boolean isDebug()
-
-