From 6b87e1ea84d1ec42d7bdb6a7a335c8cc04416779 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Wed, 13 Jul 2016 10:54:27 -0400 Subject: [PATCH] NIFI-2252: Fixed issue where POST to Controller Resource createControllerService and also ensure that URI is set on the entity. This closes #641 --- .../main/java/org/apache/nifi/web/api/ControllerResource.java | 4 ++-- .../org/apache/nifi/web/api/ControllerServiceResource.java | 2 +- .../java/org/apache/nifi/web/api/ProcessGroupResource.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java index 70514acef4..4c5ab0516a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java @@ -416,7 +416,7 @@ public class ControllerResource extends ApplicationResource { } if (isReplicateRequest()) { - return replicate(HttpMethod.GET); + return replicate(HttpMethod.POST, controllerServiceEntity); } // handle expects request (usually from the cluster manager) @@ -437,7 +437,7 @@ public class ControllerResource extends ApplicationResource { // create the controller service and generate the json final Revision revision = getRevision(controllerServiceEntity, controllerServiceEntity.getComponent().getId()); final ControllerServiceEntity entity = serviceFacade.createControllerService(revision, null, controllerServiceEntity.getComponent()); - controllerServiceResource.populateRemainingControllerServiceContent(entity.getComponent()); + controllerServiceResource.populateRemainingControllerServiceEntityContent(entity); // build the response return clusterContext(generateCreatedResponse(URI.create(entity.getUri()), entity)).build(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java index fc3524f7f2..4eb1d1ae2e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java @@ -616,7 +616,7 @@ public class ControllerServiceResource extends ApplicationResource { () -> { // update the controller service final ControllerServiceEntity entity = serviceFacade.updateControllerService(revision, requestControllerServiceDTO); - populateRemainingControllerServiceContent(entity.getComponent()); + populateRemainingControllerServiceEntityContent(entity); return clusterContext(generateOkResponse(entity)).build(); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 7074379c92..70852c1b47 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -2125,7 +2125,7 @@ public class ProcessGroupResource extends ApplicationResource { // create the controller service and generate the json final Revision revision = getRevision(controllerServiceEntity, controllerServiceEntity.getComponent().getId()); final ControllerServiceEntity entity = serviceFacade.createControllerService(revision, groupId, controllerServiceEntity.getComponent()); - controllerServiceResource.populateRemainingControllerServiceContent(entity.getComponent()); + controllerServiceResource.populateRemainingControllerServiceEntityContent(entity); // build the response return clusterContext(generateCreatedResponse(URI.create(entity.getUri()), entity)).build();