RasterizingContainer response = new RasterizingContainer();
context.put(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, clientMapInfo);
context.put(RasterizingPipelineCode.RENDERING_HINTS, renderingHints);
context.put(RasterizingPipelineCode.MAP_CONTEXT_KEY, mapContext);
pipelineService.execute(RasterizingPipelineCode.PIPELINE_RASTERIZING_GET_LEGEND_IMAGE, null, context, response);
mapContext.dispose();
try {
stream.write(response.getImage());
} catch (IOException e) {
throw new RasterException(RasterException.IMAGE_WRITING_FAILED, e);
}