From: jprocter Date: Wed, 11 Aug 2010 14:14:34 +0000 (+0000) Subject: ask user if they want to run the JabaWS tester on new URLs X-Git-Tag: Release_2_6~135 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=783111be4a80d619928cd421247bafaba4710643;p=jalview.git ask user if they want to run the JabaWS tester on new URLs --- diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index 45654f2..7ca4fd5 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -143,7 +143,7 @@ public class WsPreferences extends GWsPreferences private String editUrl(String initUrl, String title) { String url=initUrl; - URL foo; + URL foo=null; if (url==null) { url = ""; @@ -170,7 +170,14 @@ public class WsPreferences extends GWsPreferences } if (valid && resp==JOptionPane.OK_OPTION) { - return urltf.getText().trim(); + int validate = JOptionPane.showInternalConfirmDialog(Desktop.desktop, null, "Validate JabaWS Server ?\n(Look in console output for results)", JOptionPane.YES_NO_OPTION); + if (validate == JOptionPane.OK_OPTION) + { + if (jalview.ws.jws2.Jws2Discoverer.testServiceUrl(foo)) + { + return foo.toString(); + } + } } return initUrl; } diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 9897d79..cb1f49b 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -482,4 +482,28 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI : new Vector(services); } + /** + * test the given URL with the JabaWS test code + * @param foo + * @return + */ + public static boolean testServiceUrl(URL foo) + { + try { + compbio.ws.client.WSTester.main(new String[] { "-h="+foo.toString()}); + } catch (Exception e) + { + return false; + } + catch (OutOfMemoryError e) + { + return false; + } + catch (Error e) + { + return false; + } + return true; + } + }