Changeset 2924 for trunk/java-client
- Timestamp:
- 2002-01-30T02:09:44+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/util/NzdlHosts.java
r2163 r2924 122 122 } 123 123 124 static public String getUrl(String code) 125 { 126 return "http://" + getHost(code) + "/cgi-bin/getior"; 127 } 124 static public String getUrlFromSite(String sitename) 125 { 126 return "http://" + sitename + "/cgi-bin/getior"; 127 } 128 129 static public String getUrlFromCode(String code) 130 { 131 return "http://" + getFullName(code) + "/cgi-bin/getior"; 132 } 133 134 static String getIOR(URL url) 135 { 136 try { 137 InputStream his = url.openStream(); 138 DataInputStream dhis = new DataInputStream(his) ; 139 String ior = dhis.readLine(); 140 System.out.println(ior); 141 return ior; 142 } 143 catch (Throwable throwable) { 144 System.err.println("NzdlHosts:getIOR() unable to communicate with URL \"" + url + "\""); 145 } 146 return ""; 147 } 128 148 129 149 static public String getIOR(String code) … … 132 152 singleton = new NzdlHosts(); 133 153 134 String str = getUrl (code);154 String str = getUrlFromCode(code); 135 155 String ior = null; 156 URL url; 136 157 137 158 try { 138 URL url = new URL(str); 139 InputStream his = url.openStream(); 140 DataInputStream dhis = new DataInputStream(his) ; 141 ior = dhis.readLine(); 142 return ior; 143 } catch (Throwable throwable) { 159 url = new URL(str); 160 } 161 catch (Throwable malEx) { 144 162 System.err.println("NzdlHosts::getIOR() unable to construct or read URL \"" + 145 str + "\", \"" + ior + "\": " + throwable);163 str + "\", \"" + ior + "\": " + malEx); 146 164 return ""; 147 165 } 166 167 return getIOR(url); 148 168 } 149 169 … … 156 176 System.err.println("NzdlHosts::getHost() constructing NzdlServiceClient(" + 157 177 code + ") " + throwable); 178 } 179 return nzdl; 180 } 181 182 static public NzdlService getSite(String sitename) { 183 NzdlService nzdl = null; 184 185 try { 186 String siteUrl = getUrlFromSite(sitename); 187 URL url = new URL(siteUrl); 188 nzdl = new NzdlServiceClient(null,null,getIOR(url)); 189 } catch (Throwable throwable) { 190 System.err.println("NzdlHosts::getHost() constructing NzdlServiceClient(" + 191 sitename + ") " + throwable); 158 192 } 159 193 return nzdl;
Note:
See TracChangeset
for help on using the changeset viewer.