annotate flys-client/src/main/java/de/intevation/flys/client/server/MapUrlServiceImpl.java @ 2480:d46103338dfd

Fix issue462 (manualpointseditor npe when doubleclicking). flys-client/trunk@4252 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 17 Apr 2012 13:56:52 +0000
parents 0b7535e2e9aa
children 8d27d2d33d70
rev   line source
2455
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.server;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 import java.io.InputStream;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 import java.io.IOException;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 import java.util.Map;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 import java.util.HashMap;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 import java.util.Enumeration;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Document;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import org.w3c.dom.NodeList;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 import org.w3c.dom.Element;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.common.utils.XMLUtils;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 import de.intevation.artifacts.httpclient.http.HttpClient;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.client.shared.exceptions.ServerException;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.client.shared.model.Collection;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.client.client.services.MapUrlService;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 public class MapUrlServiceImpl
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 extends RemoteServiceServlet
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 implements MapUrlService
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 {
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 private static final Logger logger =
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 Logger.getLogger(MapUrlServiceImpl.class);
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 public Map<String, String> getUrls()
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 throws ServerException
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 {
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 logger.info("MapUrlServiceImpl.getUrls");
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 Map<String, String> urls = new HashMap<String, String>();
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 InputStream in = getServletContext().getResourceAsStream("/WEB-INF/wms-services.xml");
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 Document doc = XMLUtils.parseDocument(in);
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 NodeList list = doc.getElementsByTagName("wms");
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 for (int i = 0; i < list.getLength(); i++) {
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 Element e = (Element) list.item(i);
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 urls.put(e.getAttribute("url"), e.getAttribute("name"));
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 return urls;
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 }
0b7535e2e9aa Issue 508.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org