From: Diti Bhatia Date: Wed, 4 Sep 2013 20:01:50 +0000 (-0700) Subject: SwitchManager NB - Added URL info in response on successful creation of Node property... X-Git-Tag: releasepom-0.1.0~129^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=5ee3152b255f325f1b9c52271bed5c454db02a28 SwitchManager NB - Added URL info in response on successful creation of Node property and NodeConnector Property Change-Id: Iae62b1208a6b6be0f00da71e402aa2f3b8ea9843 Signed-off-by: Diti Bhatia --- diff --git a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java index 0f263ff38c..1edd945dfa 100644 --- a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java +++ b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java @@ -27,6 +27,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.core.UriInfo; import org.codehaus.enunciate.jaxrs.ResponseCode; import org.codehaus.enunciate.jaxrs.StatusCodes; @@ -254,6 +255,7 @@ public class SwitchNorthbound { @ResponseCode(code = 409, condition = "Unable to update configuration due to cluster conflict or conflicting description property"), @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") }) public Response addNodeProperty( + @Context UriInfo uriInfo, @PathParam("containerName") String containerName, @PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId, @@ -288,7 +290,7 @@ public class SwitchNorthbound { SwitchConfig newSwitchConfig = new SwitchConfig(node.toString(), nodeProperties); Status status = switchManager.updateNodeConfig(newSwitchConfig); if (status.isSuccess()) { - return Response.status(Response.Status.CREATED).build(); + return Response.created(uriInfo.getRequestUri()).build(); } return NorthboundUtils.getResponse(status); } @@ -534,6 +536,7 @@ public class SwitchNorthbound { @ResponseCode(code = 409, condition = "Unable to add property due to cluster conflict"), @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") }) public Response addNodeConnectorProperty( + @Context UriInfo uriInfo, @PathParam("containerName") String containerName, @PathParam("nodeType") String nodeType, @PathParam("nodeId") String nodeId, @@ -574,7 +577,7 @@ public class SwitchNorthbound { Status ret = switchManager.addNodeConnectorProp(nc, prop); if (ret.isSuccess()) { - return Response.status(Response.Status.CREATED).build(); + return Response.created(uriInfo.getRequestUri()).build(); } throw new InternalServerErrorException(ret.getDescription()); }