resp.setEntity(format.toRepresentation(buildContext(namespace, f)));
}
private Map buildContext(String namespace, SimpleFeature f) {
Map m = new HashMap();
FeatureTemplate t = new FeatureTemplate();
m.put(
"typeName",
namespace
+ ":"
+ f.getType().getName().getLocalPart()
);
m.put("kmllink", buildURL(GEOSERVER_BASE_URL, f.getIdentifier().toString() + "_goto.kml", null, URLType.SERVICE));
m.put("rawkmllink", buildURL(GEOSERVER_BASE_URL, f.getIdentifier().toString() + ".kml?raw=true", null, URLType.SERVICE));
try {
m.put("name", t.title(f));
} catch (IOException e) {
m.put("name", f.getIdentifier().toString());
}
try {
m.put("description", t.description(f));
} catch (IOException e) {
m.put("description", "");
}
return m;