public class OsmConnection extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
OsmConnection.OAuthAccessTokenFetcher
Retrieves OAuth access token.
|
Modifier and Type | Field and Description |
---|---|
protected HttpClient |
activeConnection |
private static java.lang.String |
BASIC_AUTH |
protected boolean |
cancel |
(package private) static OsmConnection.OAuthAccessTokenFetcher |
fetcher |
protected OAuthParameters |
oauthParameters |
Constructor and Description |
---|
OsmConnection() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAuth(HttpClient connection) |
protected void |
addBasicAuthorizationHeader(HttpClient con)
Adds an authentication header for basic authentication
|
protected void |
addOAuthAuthorizationHeader(HttpClient connection)
Signs the connection with an OAuth authentication header
|
void |
cancel()
Cancels the connection.
|
boolean |
isCanceled()
Replies true if this connection is canceled
|
protected void |
obtainAccessToken(HttpClient connection)
Obtains an OAuth access token for the connection.
|
protected java.lang.String |
retrieveBasicAuthorizationLogin(HttpClient con)
Retrieves login from basic authentication header, if set.
|
static void |
setOAuthAccessTokenFetcher(OsmConnection.OAuthAccessTokenFetcher tokenFetcher)
Sets the OAuth access token fetcher.
|
private static final java.lang.String BASIC_AUTH
protected boolean cancel
protected HttpClient activeConnection
protected OAuthParameters oauthParameters
static volatile OsmConnection.OAuthAccessTokenFetcher fetcher
public OsmConnection()
public static void setOAuthAccessTokenFetcher(OsmConnection.OAuthAccessTokenFetcher tokenFetcher)
tokenFetcher
- new OAuth access token fetcher. Cannot be nullpublic void cancel()
protected java.lang.String retrieveBasicAuthorizationLogin(HttpClient con) throws OsmTransferException
con
- the connectionnull
OsmTransferException
- if something went wrong. Check for nested exceptionsprotected void addBasicAuthorizationHeader(HttpClient con) throws OsmTransferException
con
- the connectionOsmTransferException
- if something went wrong. Check for nested exceptionsprotected void addOAuthAuthorizationHeader(HttpClient connection) throws OsmTransferException
connection
- the connectionMissingOAuthAccessTokenException
- if there is currently no OAuth Access Token configuredOsmTransferException
- if signing failsprotected void obtainAccessToken(HttpClient connection) throws MissingOAuthAccessTokenException
OAuthAccessTokenHolder
/ CredentialsManager
.connection
- connection for which the access token should be obtainedMissingOAuthAccessTokenException
- if the process cannot be completed successfullyprotected void addAuth(HttpClient connection) throws OsmTransferException
OsmTransferException
public boolean isCanceled()