protected Representation doGetInternal(String layerName, String gridSetId, String type)
throws RestletException {
TileLayer tl = findTileLayer(layerName, layerDispatcher);
if(tl == null) {
throw new RestletException(layerName + " is not known", Status.CLIENT_ERROR_NOT_FOUND);
}
GridSubset grid = tl.getGridSubset(gridSetId);
if(grid == null) {
throw new RestletException(layerName + " does not support " + gridSetId, Status.CLIENT_ERROR_NOT_FOUND);
}
StringBuilder str = new StringBuilder();
long[][] bounds = grid.getCoverages();
if(type.equalsIgnoreCase("java")) {
str.append("{");
for(int i=0; i<bounds.length; i++) {
str.append("{");
for(int j=0; j<bounds[i].length; j++) {
str.append(bounds[i][j]);
if(j+1 < bounds[i].length) {
str.append(", ");
}
}
str.append("}");
if(i+1 < bounds.length) {
str.append(", ");
}
}
str.append("}");
return new StringRepresentation(str.toString(), MediaType.TEXT_PLAIN);
} else {
throw new RestletException("Unknown or missing format extension : " + type,
Status.CLIENT_ERROR_BAD_REQUEST);
}
}