Merge "Change in AbstractRaftBehavior#performSnapshotWithoutCapture"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / AbstractIdentifierAwareJaxRsProvider.java
index 978ae0d9c5205e528a0bee6de31702251fd180f4..7b190e0dc439675a06a4b8892c8292a4c8b2c0d0 100644 (file)
@@ -2,6 +2,7 @@ package org.opendaylight.controller.sal.rest.impl;
 
 import com.google.common.base.Optional;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Request;
 import javax.ws.rs.core.UriInfo;
 import org.opendaylight.controller.sal.rest.api.RestconfConstants;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
@@ -9,11 +10,16 @@ import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
 
 public class AbstractIdentifierAwareJaxRsProvider {
 
+    private static final String POST = "POST";
+
     @Context
     private UriInfo uriInfo;
 
+    @Context
+    private Request request;
+
     protected final String getIdentifier() {
-        return uriInfo.getPathParameters().getFirst(RestconfConstants.IDENTIFIER);
+        return uriInfo.getPathParameters(false).getFirst(RestconfConstants.IDENTIFIER);
     }
 
     protected final Optional<InstanceIdentifierContext> getIdentifierWithSchema() {
@@ -27,4 +33,8 @@ public class AbstractIdentifierAwareJaxRsProvider {
     protected UriInfo getUriInfo() {
         return uriInfo;
     }
+
+    protected boolean isPost() {
+        return POST.equals(request.getMethod());
+    }
 }