boolean isKeep = "id".equals(path.segment(0));
String taskId = path.segment(1);
ITaskService taskService = taskTracker.getService();
try {
taskService.cancelTask(TaskJobHandler.getUserId(req), taskId, isKeep);
} catch (TaskDoesNotExistException e) {
handleException(resp, "Could not cancel task that does not exist: " + e.getTaskId(), e, HttpServletResponse.SC_NOT_FOUND);
return;
} catch (TaskOperationException e) {
handleException(resp, e.getMessage(), e);