@ApiOperation(value="Retrieves process instance image", response=String.class, code=200) @ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Process instance, image or Container Id not found") }) @GET @Path(PROCESS_INST_IMG_GET_URI) @Produces({MediaType.APPLICATION_SVG_XML}) public Response getProcessInstanceImage(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that process instance belongs to", required = true) @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of the process instance that image should be loaded for", required = true) @PathParam(PROCESS_INST_ID) Long procInstId) { Variant v = getVariant(headers); Header conversationIdHeader = buildConversationIdHeader(containerId, context, headers); try { String svgString = imageServiceBase.getActiveProcessImage(containerId, procInstId); logger.debug("Returning OK response with content '{}'", svgString); return createResponse(svgString, v, Response.Status.OK, conversationIdHeader); } catch (ProcessInstanceNotFoundException e) { return notFound(MessageFormat.format("Not found", e.getMessage()), v, conversationIdHeader); } catch (IllegalArgumentException e) { return notFound("Image for process instance id " + procInstId + " not found", v, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(MessageFormat.format("Unexpected error encountered", e.getMessage()), v, conversationIdHeader); } } }