diff --git a/io/src/main/java/org/gcube/resourcemanagement/manager/io/rs/ContextPath.java b/io/src/main/java/org/gcube/resourcemanagement/manager/io/rs/ContextPath.java index 03c77bd..81dbf02 100644 --- a/io/src/main/java/org/gcube/resourcemanagement/manager/io/rs/ContextPath.java +++ b/io/src/main/java/org/gcube/resourcemanagement/manager/io/rs/ContextPath.java @@ -8,8 +8,10 @@ package org.gcube.resourcemanagement.manager.io.rs; */ public class ContextPath { - public static final String ROOT = "context"; - public static final String SCHEMA_PATH_PART = "schema"; - public static final String POLYMORPHIC_PARAM = "polymorphic"; + public static final String CONTEXT_ROOT = "context"; + + public static final String CREATE_PATH_PART = "create"; + + } diff --git a/webapp/src/main/java/org/gcube/resourcemanagement/manager/webapp/rs/Context.java b/webapp/src/main/java/org/gcube/resourcemanagement/manager/webapp/rs/Context.java index 3782831..992f2a1 100644 --- a/webapp/src/main/java/org/gcube/resourcemanagement/manager/webapp/rs/Context.java +++ b/webapp/src/main/java/org/gcube/resourcemanagement/manager/webapp/rs/Context.java @@ -1,12 +1,10 @@ package org.gcube.resourcemanagement.manager.webapp.rs; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import org.gcube.resourcemanagement.manager.io.rs.*; import org.gcube.resourcemanagement.manager.webapp.ResourceInitializer; @@ -19,25 +17,25 @@ import org.slf4j.LoggerFactory; * @author Manuele Simi (ISTI-CNR) * */ -@Path(ContextPath.ROOT) +@Path(ContextPath.CONTEXT_ROOT) public class Context { private static Logger logger = LoggerFactory.getLogger(Context.class); - - public static final String ID_PATH_PARAM = "id"; - public static final String TYPE_PATH_PARAM = "type"; /* * e.g. POST /resource-manager/context/ */ @POST - @Path(ContextPath.SCHEMA_PATH_PART + "/{" + TYPE_PATH_PARAM + "}") + @Path(ContextPath.CREATE_PATH_PART) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) - public String create(@PathParam(TYPE_PATH_PARAM) String type, - @QueryParam(ContextPath.POLYMORPHIC_PARAM) @DefaultValue("false") Boolean polymorphic) + public Response create(String json) { - logger.info("Requested resource to be added to for type {}", type); + logger.info("Requested to create context {} with json {}", + org.gcube.informationsystem.model.entity.Context.NAME, json); + String response = ""; + //TODO + return Response.status(Status.CREATED).entity(response). + type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build(); - return ""; } }