Revision 3324
org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSProtocolHandlerFactory.java | ||
---|---|---|
192 | 192 |
} |
193 | 193 |
|
194 | 194 |
private static String readFromUrl(String url_s, int size) throws IOException { |
195 |
|
|
196 | 195 |
URL url = new URL(url_s); |
197 |
|
|
198 | 196 |
Utilities.removeURL(url); |
199 |
File f = Utilities.downloadFile(url,null,"wms_capabilities.xml", null,size);
|
|
197 |
File f = Utilities.downloadFile(url, "wms_capabilities.xml", null);
|
|
200 | 198 |
return FileUtils.readFileToString(f); |
201 | 199 |
} |
202 | 200 |
|
... | ... | |
204 | 202 |
String request = WMSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version); |
205 | 203 |
String version = new String(); |
206 | 204 |
StringReader reader = null; |
207 |
// DataInputStream dis = null; |
|
208 | 205 |
try { |
209 |
// URL url = new URL(request); |
|
210 |
// byte[] buffer = new byte[size]; |
|
211 |
// URLConnection conn = url.openConnection(); |
|
212 |
// conn.setRequestProperty("Accept", "text/xml, text/*, */*"); |
|
213 |
// conn.setRequestProperty("User-Agent", "Mozilla/5.0 (gvSIG) like Gecko"); |
|
214 |
// dis = new DataInputStream(conn.getInputStream()); |
|
215 |
// dis.readFully(buffer); |
|
216 |
// String string = new String(buffer); |
|
217 | 206 |
String string = readFromUrl(request, size); |
218 | 207 |
|
219 | 208 |
// patch for ArcIMS + WMS connector > 9.0 bug |
... | ... | |
238 | 227 |
// do not forget to close the Stream. |
239 | 228 |
reader.close(); |
240 | 229 |
reader = null; |
241 |
// dis.close(); |
|
242 | 230 |
return version; |
243 | 231 |
} catch (ConnectException conEx) { |
244 | 232 |
throw new ConnectException(conEx.getMessage()); |
... | ... | |
256 | 244 |
logger.warn("Can't close reader", ex); |
257 | 245 |
} |
258 | 246 |
} |
259 |
// if ( dis != null ) { |
|
260 |
// try { |
|
261 |
// dis.close(); |
|
262 |
// } catch (Exception ex) { |
|
263 |
// logger.warn("Can't close input stream", ex); |
|
264 |
// } |
|
265 |
// } |
|
266 | 247 |
} |
267 | 248 |
} |
268 | 249 |
|
Also available in: Unified diff