final ImageUrlCallback callBack = imageCallBack;
GwtCommandDispatcher.getInstance().execute(commandRequest, new CommandCallback() {
public void execute(CommandResponse commandResponse) {
if (commandResponse instanceof RasterizeMapResponse) {
RasterizeMapResponse rasterizeMapResponse = (RasterizeMapResponse) commandResponse;
callBack.onImageUrl(toUrl(rasterizeMapResponse.getMapKey()),
toUrl(rasterizeMapResponse.getLegendKey()));
}
}
});