|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.gui.PleaseWaitRunnable
org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTask
public class ApiUrlTestTask
This is an asynchronous task for testing whether an URL points to an OSM API server.
It tries to retrieve a list of changesets from the given URL. If it succeeds, the method
isSuccess()
replies true, otherwise false.
Note: it fetches a list of changesets instead of the much smaller capabilities because - strangely enough -
an OSM server "http://x.y.y/api/0.6" not only responds to "http://x.y.y/api/0.6/capabilities" but also
to "http://x.y.y/api/0/capabilities" or "http://x.y.y/a/capabilities" with valid capabilities. If we get
valid capabilities with an URL we therefore can't be sure that the base URL is valid API URL.
Field Summary | |
---|---|
private boolean |
canceled
|
private java.net.HttpURLConnection |
connection
|
private java.awt.Component |
parent
|
private boolean |
success
|
private java.lang.String |
url
|
Fields inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable |
---|
progressMonitor |
Constructor Summary | |
---|---|
ApiUrlTestTask(java.awt.Component parent,
java.lang.String url)
Creates the task |
Method Summary | |
---|---|
protected void |
alertConnectionFailed()
|
protected void |
alertInvalidChangesetList()
|
protected void |
alertInvalidChangesetUrl(java.lang.String url)
|
protected void |
alertInvalidServerResult(int retCode)
|
protected void |
alertInvalidUrl(java.lang.String url)
|
protected void |
cancel()
User pressed cancel button. |
protected void |
finish()
Finish up the data work. |
protected java.lang.String |
getNormalizedApiUrl()
Removes leading and trailing whitespace from the API URL and removes trailing '/'. |
boolean |
isCanceled()
|
boolean |
isSuccess()
|
protected void |
realRun()
Called in the worker thread to do the actual work. |
Methods inherited from class org.openstreetmap.josm.gui.PleaseWaitRunnable |
---|
afterFinish, canRunInBackground, getProgressMonitor, operationCanceled, run |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String url
private boolean canceled
private boolean success
private java.awt.Component parent
private java.net.HttpURLConnection connection
Constructor Detail |
---|
public ApiUrlTestTask(java.awt.Component parent, java.lang.String url) throws java.lang.IllegalArgumentException
parent
- the parent component relative to which the PleaseWaitRunnable
-Dialog is displayedurl
- the url. Must not be null.
java.lang.IllegalArgumentException
- thrown if url is null.Method Detail |
---|
protected void alertInvalidUrl(java.lang.String url)
protected void alertInvalidChangesetUrl(java.lang.String url)
protected void alertConnectionFailed()
protected void alertInvalidServerResult(int retCode)
protected void alertInvalidChangesetList()
protected void cancel()
PleaseWaitRunnable
cancel
in class PleaseWaitRunnable
protected void finish()
PleaseWaitRunnable
finish
in class PleaseWaitRunnable
protected java.lang.String getNormalizedApiUrl()
protected void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
PleaseWaitRunnable
realRun
in class PleaseWaitRunnable
org.xml.sax.SAXException
java.io.IOException
OsmTransferException
public boolean isCanceled()
public boolean isSuccess()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |