@Override public void sendContent( OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, BadRequestException { WorkbenchState state = WorkbenchState.instance(SessionContext.current()); IMap map = state.getMap(); try { JSONObject json = new JSONObject(); json.put("width", -1); json.put("height", -1); ReferencedEnvelope extent = map.getExtent(); json.put("minX", extent.getMinX()); json.put("minY", extent.getMinY()); json.put("maxX", extent.getMaxX()); json.put("maxY", extent.getMaxY()); out.write(json.toString(4).getBytes("UTF-8")); } catch (JSONException e) { throw new RuntimeException(e); } }