Revision 41285 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.remoteclient/src/main/java/org/gvsig/remoteclient/wms/WMSProtocolHandler.java
WMSProtocolHandler.java | ||
---|---|---|
51 | 51 |
import org.gvsig.remoteclient.wms.request.WMSGetLegendGraphicRequest; |
52 | 52 |
import org.gvsig.remoteclient.wms.request.WMSGetMapRequest; |
53 | 53 |
import org.kxml2.io.KXmlParser; |
54 |
import org.slf4j.Logger; |
|
55 |
import org.slf4j.LoggerFactory; |
|
54 | 56 |
import org.xmlpull.v1.XmlPullParserException; |
55 | 57 |
|
56 | 58 |
/** |
... | ... | |
59 | 61 |
* |
60 | 62 |
*/ |
61 | 63 |
public abstract class WMSProtocolHandler extends OGCProtocolHandler { |
64 |
|
|
65 |
private static final Logger logger = LoggerFactory.getLogger(WMSProtocolHandler.class); |
|
62 | 66 |
/** |
63 | 67 |
* Encoding used to parse different xml documents. |
64 | 68 |
*/ |
... | ... | |
100 | 104 |
try { |
101 | 105 |
request = new URL(buildCapabilitiesRequest(status)); |
102 | 106 |
} catch(Exception e) { |
103 |
e.printStackTrace();
|
|
107 |
logger.warn("Can't get capabilities, error building url.",e);
|
|
104 | 108 |
} |
105 | 109 |
try { |
106 | 110 |
if (override) |
... | ... | |
113 | 117 |
clear(); |
114 | 118 |
parseCapabilities(f); |
115 | 119 |
} catch(Exception e) { |
116 |
e.printStackTrace();
|
|
120 |
logger.warn("Can't get capabilities.",e);
|
|
117 | 121 |
} |
118 | 122 |
} |
119 | 123 |
|
... | ... | |
196 | 200 |
} |
197 | 201 |
catch(Exception e) |
198 | 202 |
{ |
199 |
e.printStackTrace();
|
|
203 |
logger.warn("Can't get information by point.",e);
|
|
200 | 204 |
sb.append("<INFO>").append("Info format not supported").append("</INFO>"); |
201 | 205 |
return sb.toString(); |
202 | 206 |
|
... | ... | |
217 | 221 |
URL url = request.getURL(); |
218 | 222 |
|
219 | 223 |
URLConnection conn = url.openConnection(); |
220 |
System.out.println(request.toString());
|
|
224 |
logger.info(request.toString());
|
|
221 | 225 |
String type = conn.getContentType(); |
222 | 226 |
|
223 | 227 |
|
... | ... | |
269 | 273 |
} |
270 | 274 |
catch(IOException e) |
271 | 275 |
{ |
272 |
e.printStackTrace();
|
|
273 |
throw new ServerErrorException(); |
|
276 |
logger.warn("Can't build map request.",e);
|
|
277 |
throw new ServerErrorException();
|
|
274 | 278 |
} |
275 | 279 |
} |
276 | 280 |
|
... | ... | |
311 | 315 |
} |
312 | 316 |
catch(IOException e) |
313 | 317 |
{ |
314 |
e.printStackTrace();
|
|
315 |
throw new ServerErrorException(); |
|
318 |
logger.warn("Can't get legend graphics.",e);
|
|
319 |
throw new ServerErrorException();
|
|
316 | 320 |
} |
317 | 321 |
} |
318 | 322 |
|
... | ... | |
321 | 325 |
URL request = null; |
322 | 326 |
try { |
323 | 327 |
request = new URL(buildGetLegendGraphicRequest(status, layerName)); |
324 |
System.out.println(request);
|
|
328 |
logger.info(request.toString());
|
|
325 | 329 |
File f = Utilities.downloadFile(request, "wmsGetLegendGraphic", cancel); |
326 | 330 |
if (f== null) |
327 | 331 |
return null; |
... | ... | |
353 | 357 |
} |
354 | 358 |
return f; |
355 | 359 |
} catch(IOException e) { |
356 |
e.printStackTrace();
|
|
357 |
throw new ServerErrorException(); |
|
360 |
logger.warn("Can't get legend graphics",e);
|
|
361 |
throw new ServerErrorException();
|
|
358 | 362 |
} |
359 | 363 |
} |
360 | 364 |
|
... | ... | |
391 | 395 |
req.append(onlineResource + symbol + "REQUEST=GetLegendGraphic&SERVICE=WMS&VERSION=").append(getVersion()); |
392 | 396 |
req.append("&LAYER=" + layerName).append("&TRANSPARENT=TRUE").append("&FORMAT=image/png"); |
393 | 397 |
String aux = req.toString().replaceAll(" ", "%20"); |
394 |
System.out.println("GetLegendGraphic url:" + aux);
|
|
398 |
logger.info("GetLegendGraphic url:" + aux);
|
|
395 | 399 |
return aux; |
396 | 400 |
} |
397 | 401 |
|
... | ... | |
400 | 404 |
WMSGetMapRequest request = createGetMapRequest(status); |
401 | 405 |
return request.getURL(); |
402 | 406 |
} catch(IOException e) { |
403 |
e.printStackTrace();
|
|
404 |
throw new ServerErrorException(); |
|
407 |
logger.warn("Can't get map URL",e);
|
|
408 |
throw new ServerErrorException();
|
|
405 | 409 |
} |
406 | 410 |
} |
407 | 411 |
|
... | ... | |
511 | 515 |
} |
512 | 516 |
} |
513 | 517 |
catch(XmlPullParserException parser_ex){ |
514 |
parser_ex.printStackTrace();
|
|
518 |
logger.warn("",parser_ex);
|
|
515 | 519 |
} |
516 | 520 |
catch (IOException ioe) { |
517 |
ioe.printStackTrace();
|
|
521 |
logger.warn("",ioe);
|
|
518 | 522 |
} |
519 | 523 |
String message = errors.size()>0? "" : null; |
520 | 524 |
for (int i = 0; i < errors.size(); i++) { |
Also available in: Unified diff