@RequestMapping(value="/history/historic-process-instances/{processInstanceId}/comments", method = RequestMethod.POST, produces = "application/json")
public CommentResponse createComment(@PathVariable String processInstanceId, @RequestBody CommentResponse comment,
HttpServletRequest request, HttpServletResponse response) {
HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
if (comment.getMessage() == null) {
throw new ActivitiIllegalArgumentException("Comment text is required.");
}
Comment createdComment = taskService.addComment(null, instance.getId(), comment.getMessage());
response.setStatus(HttpStatus.CREATED.value());
String serverRootUrl = request.getRequestURL().toString();
serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/history/historic-process-instances/"));
return restResponseFactory.createRestComment(createdComment, serverRootUrl);