org.openstreetmap.josm.io
Class OsmConnection

java.lang.Object
  extended by org.openstreetmap.josm.io.OsmConnection
Direct Known Subclasses:
OsmApi, OsmServerReader, ServerSidePreferences.Connection

public class OsmConnection
extends java.lang.Object

Base class that handles common things like authentication for the reader and writer to the osm server.


Field Summary
protected  java.net.HttpURLConnection activeConnection
           
protected  boolean cancel
           
protected  OAuthParameters oauthParameters
           
 
Constructor Summary
OsmConnection()
           
 
Method Summary
protected  void addAuth(java.net.HttpURLConnection connection)
           
protected  void addBasicAuthorizationHeader(java.net.HttpURLConnection con)
          Adds an authentication header for basic authentication
protected  void addOAuthAuthorizationHeader(java.net.HttpURLConnection connection)
          Signs the connection with an OAuth authentication header
 void cancel()
           
 boolean isCanceled()
          Replies true if this connection is canceled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cancel

protected boolean cancel

activeConnection

protected java.net.HttpURLConnection activeConnection

oauthParameters

protected OAuthParameters oauthParameters
Constructor Detail

OsmConnection

public OsmConnection()
Method Detail

cancel

public void cancel()

addBasicAuthorizationHeader

protected void addBasicAuthorizationHeader(java.net.HttpURLConnection con)
                                    throws OsmTransferException
Adds an authentication header for basic authentication

Parameters:
con - the connection
Throws:
OsmTransferException - thrown if something went wrong. Check for nested exceptions

addOAuthAuthorizationHeader

protected void addOAuthAuthorizationHeader(java.net.HttpURLConnection connection)
                                    throws OsmTransferException
Signs the connection with an OAuth authentication header

Parameters:
connection - the connection
Throws:
OsmTransferException - thrown if there is currently no OAuth Access Token configured
OsmTransferException - thrown if signing fails

addAuth

protected void addAuth(java.net.HttpURLConnection connection)
                throws OsmTransferException
Throws:
OsmTransferException

isCanceled

public boolean isCanceled()
Replies true if this connection is canceled

Returns:
true if this connection is canceled


JOSM