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 executingOAuthTokenInterceptor
depending 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 class
OAuthTokenWebListener.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuthTokenFinish
call()
void
finalize()
static OAuthTokenWebListener.Builder
forMode(OAuthMode mode)
Create a newOAuthTokenWebListener
with some clever defaults for aOAuthMode
.java.util.concurrent.Future<OAuthTokenFinish>
getToken()
Get the token generated by the OAuth process.java.net.URI
start()
Start the server created by the @{link Builder}.void
stop()
Stop the listener server so the port becomes available again.
-
-
-
Method Detail
-
forMode
public static OAuthTokenWebListener.Builder forMode(OAuthMode mode)
Create a newOAuthTokenWebListener
with some clever defaults for aOAuthMode
.- Parameters:
mode
-OAuthMode
supported 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 aFuture
because the token may not be received by the server when this method is called.- Returns:
- Returns an
OAuthTokenFinish
wrapped in aFuture
. TheOAuthTokenFinish
should at least contain a token
-
call
public OAuthTokenFinish call() throws java.lang.Exception
- Specified by:
call
in 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:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-