annotate flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java @ 3497:88feb3347aa5

Implement a ProxyServlet Implement a ProxyServlet to be able to restrict the access to the mapserver too. All queries to the provided map services should go throught this new ProxyServlet. Currently the ProxyServlet can only handle HTTP GET requests. flys-client/trunk@5221 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Thu, 16 Aug 2012 14:42:36 +0000
parents 661e3ae77c8a
children f8409fbe3b88
rev   line source
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.shared;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
2440
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
3 import java.util.Date;
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
4
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 public class MapUtils {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 public static final String GET_LEGEND_GRAPHIC_TEMPLATE =
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 "${SERVER}SERVICE=WMS&VERSION=1.1.1&layer=${LAYER}" +
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 "&REQUEST=getLegendGraphic&FORMAT=image/png";
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 private MapUtils() {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 public static String getLegendGraphicUrl(String server, String layer) {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 if (server == null || layer == null) {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 return null;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 server = server.indexOf("?") >= 0 ? server : server + "?";
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 String url = GET_LEGEND_GRAPHIC_TEMPLATE;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 url = url.replace("${SERVER}", server);
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 url = url.replace("${LAYER}", layer);
2440
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
27 url = url + "&timestamp=" + new Date().getTime();
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 return url;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org