From fd0368b8b524aa57795937346ef000e4b3fe8cbd Mon Sep 17 00:00:00 2001 From: Mohamed Rashd Date: Mon, 29 Nov 2021 15:26:35 +0530 Subject: [PATCH] Change api that checks if an appName already exists, to accept the appName as query parameter instead of context-path --- .../api/services/ApplicationManagementPublisherAPI.java | 4 ++-- .../impl/ApplicationManagementPublisherAPIImpl.java | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/ApplicationManagementPublisherAPI.java b/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/ApplicationManagementPublisherAPI.java index f82ce53f2d..1cd1411da3 100644 --- a/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/ApplicationManagementPublisherAPI.java +++ b/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/ApplicationManagementPublisherAPI.java @@ -683,7 +683,7 @@ public interface ApplicationManagementPublisherAPI { ); @GET - @Path("/device-type/{deviceType}/app-name/{appName}") + @Path("/device-type/{deviceType}/app-name") @ApiOperation( httpMethod = "GET", value = "Check the application existence", @@ -723,7 +723,7 @@ public interface ApplicationManagementPublisherAPI { name = "appName", value = "Application name", required = true) - @PathParam("appName") String appName + @QueryParam("appName") String appName ); @PUT diff --git a/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java index f88c005fb1..8b156bbf9d 100644 --- a/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.publisher.api/src/main/java/io/entgra/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java @@ -390,11 +390,16 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem @Override @GET - @Path("/device-type/{deviceType}/app-name/{appName}") + @Path("/device-type/{deviceType}/app-name") public Response isExistingApplication( @PathParam("deviceType") String deviceType, - @PathParam("appName") String appName ){ + @QueryParam("appName") String appName){ try { + if (appName == null) { + String msg = "Invalid app name, appName query param cannot be empty/null."; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).build(); + } ApplicationManager applicationManager = APIUtil.getApplicationManager(); if (applicationManager.isExistingAppName(appName, deviceType)) { return Response.status(Response.Status.CONFLICT).build();