Class OAuthTokenWebListener
- java.lang.Object
-
- org.syncany.plugins.transfer.oauth.OAuthTokenWebListener
-
- All Implemented Interfaces:
java.util.concurrent.Callable<OAuthTokenFinish>
public class OAuthTokenWebListener extends java.lang.Object implements java.util.concurrent.Callable<OAuthTokenFinish>
This class creates a server handling the OAuth callback URLs. It has two tasks. First it is responsible for executingOAuthTokenInterceptordepending on a path defined by the interceptor itself. Furthermore it does the token parsing in the URL using aOAuthTokenExtractor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOAuthTokenWebListener.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuthTokenFinishcall()voidfinalize()static OAuthTokenWebListener.BuilderforMode(OAuthMode mode)Create a newOAuthTokenWebListenerwith some clever defaults for aOAuthMode.java.util.concurrent.Future<OAuthTokenFinish>getToken()Get the token generated by the OAuth process.java.net.URIstart()Start the server created by the @{link Builder}.voidstop()Stop the listener server so the port becomes available again.
-
-
-
Method Detail
-
forMode
public static OAuthTokenWebListener.Builder forMode(OAuthMode mode)
Create a newOAuthTokenWebListenerwith some clever defaults for aOAuthMode.- Parameters:
mode-OAuthModesupported by theTransferPlugin.- Returns:
- A ready to use
OAuthTokenWebListener.
-
start
public java.net.URI start()
Start the server created by the @{link Builder}.- Returns:
- A callback URI which should be used during the OAuth process.
-
getToken
public java.util.concurrent.Future<OAuthTokenFinish> getToken()
Get the token generated by the OAuth process. In fact, this class returns aFuturebecause the token may not be received by the server when this method is called.- Returns:
- Returns an
OAuthTokenFinishwrapped in aFuture. TheOAuthTokenFinishshould at least contain a token
-
call
public OAuthTokenFinish call() throws java.lang.Exception
- Specified by:
callin interfacejava.util.concurrent.Callable<OAuthTokenFinish>- Throws:
java.lang.Exception
-
stop
public void stop()
Stop the listener server so the port becomes available again.
-
finalize
public void finalize() throws java.lang.Throwable
- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-