diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2016-10-19 17:52:42 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2016-10-19 17:52:42 +0800 |
commit | cddbebf090d52a234e536bef5f7e6dbd6ddcc9e0 (patch) | |
tree | 10f329c30822381f6b708cce5aba9777aa7bc620 | |
parent | a42e5251bed0f92a3a429dfe0e7805bf7d271515 (diff) |
GSO-26 Fix the wrong url sent to service gateway. Modify the codes for deleting service to be consistent with the api.
Change-Id: If9242f8c956d5e93f49c4359a959343ed34cfefb
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
3 files changed, 9 insertions, 15 deletions
diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js index 30231fca..37cb05f3 100644 --- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js +++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js @@ -357,7 +357,7 @@ function formatDate(date) { function deleteNe(rowId, row) { var instanceId = row.serviceId; var serviceType = row.serviceType; - var gatewayService = '/openoapi/servicegateway/v1/services'; + var gatewayService = '/openoapi/servicegateway/v1/services/' + instanceId + '/terminate'; var remove = function () { $('#sai').bootstrapTable('remove', {field: 'serviceId', values: [instanceId]}); }; @@ -404,7 +404,7 @@ function deleteNetworkServiceInstance(gatewayService, nsUri, instanceId) { 'gatewayUri': instanceUri }; return $.ajax({ - type: "DELETE", + type: "POST", url: gatewayService, contentType: "application/json", dataType: "json", @@ -423,7 +423,7 @@ function terminateNetworkServiceInstance(gatewayService, nsUri, instanceId) { 'gatewayUri': nsTerminateUri }; return $.ajax({ - type: "DELETE", + type: "POST", url: gatewayService, contentType: "application/json", dataType: "json", diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/inf/IServiceGatewayRoaModule.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/inf/IServiceGatewayRoaModule.java index 302b2bd9..0e8b03ce 100644 --- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/inf/IServiceGatewayRoaModule.java +++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/roa/inf/IServiceGatewayRoaModule.java @@ -18,7 +18,6 @@ package org.openo.gso.gui.servicegateway.roa.inf; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -63,10 +62,10 @@ public interface IServiceGatewayRoaModule { * @throws ServiceException when operate database or parameter is wrong. * @since GSO 0.5 */ - @DELETE + @POST @Produces({"application/json"}) @Consumes({"application/json"}) - @Path("/{serviceId}") + @Path("/{serviceId}/terminate") Response deleteService(@PathParam("serviceId") String serviceId, @Context HttpServletRequest servletReq) throws ServiceException; diff --git a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java index c3dee4a3..3ff4f89b 100644 --- a/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java +++ b/servicegateway/service/src/main/java/org/openo/gso/gui/servicegateway/service/impl/ServiceGatewayImpl.java @@ -139,21 +139,16 @@ public class ServiceGatewayImpl implements IServiceGateway { // Parse request String reqContent = RestUtils.getRequestBody(httpRequest); Map<String, Object> requestBody = JsonUtil.unMarshal(reqContent, Map.class); - Map<String, Object> service = (Map<String, Object>)requestBody.get(Constant.SERVICE_INDENTIFY); - if(null == service) - { - service = requestBody; - } ValidateUtil.assertObjectNotNull(requestBody); // Validate data - String gatewayUri = (String)service.get(Constant.SERVICE_GATEWAY_URI); + String gatewayUri = (String)requestBody.get(Constant.SERVICE_GATEWAY_URI); ValidateUtil.assertStringNotNull(gatewayUri); - service.remove(Constant.SERVICE_GATEWAY_URI); + requestBody.remove(Constant.SERVICE_GATEWAY_URI); - String operation = (String) service.get(Constant.SERVICE_OPERATION); + String operation = (String) requestBody.get(Constant.SERVICE_OPERATION); ValidateUtil.assertStringNotNull(operation); - service.remove(Constant.SERVICE_OPERATION); + requestBody.remove(Constant.SERVICE_OPERATION); // call the restful try { |