PUt parameter moved from query params to content

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@134412 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-11-21 09:07:28 +00:00
parent cf36f9784a
commit 3a0541a8b4
1 changed files with 26 additions and 11 deletions

View File

@ -5,7 +5,6 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.PUT; import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; import org.gcube.informationsystem.resourceregistry.api.SchemaManagement;
@ -28,7 +27,11 @@ public class SchemaManager {
protected SchemaManagement schemaManager = new SchemaManagementImpl(); protected SchemaManagement schemaManager = new SchemaManagementImpl();
/** /**
* e.g. PUT /resource-registry/schema/embedded?schema={...} * e.g. PUT /resource-registry/schema/embedded
*
* BODY: {...}
*
* ?schema={...}
* @param jsonSchema * @param jsonSchema
* @return * @return
* @throws SchemaException * @throws SchemaException
@ -37,13 +40,16 @@ public class SchemaManager {
@Path(SchemaPath.EMBEDDED_PATH_PART) @Path(SchemaPath.EMBEDDED_PATH_PART)
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String registerEmbeddedTypeSchema(@QueryParam(SchemaPath.SCHEMA_PARAM) String jsonSchema) throws SchemaException { public String registerEmbeddedTypeSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested Embedded registration with schema {}",jsonSchema); logger.trace("Requested Embedded registration with schema {}",jsonSchema);
return schemaManager.registerEmbeddedTypeSchema(jsonSchema); return schemaManager.registerEmbeddedTypeSchema(jsonSchema);
} }
/** /**
* e.g. PUT /resource-registry/schema/facet?schema={...} * e.g. PUT /resource-registry/schema/facet
*
* BODY: {...}
*
* @param jsonSchema * @param jsonSchema
* @return * @return
* @throws SchemaException * @throws SchemaException
@ -52,13 +58,16 @@ public class SchemaManager {
@Path(SchemaPath.FACET_PATH_PART) @Path(SchemaPath.FACET_PATH_PART)
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String registerFacetSchema(@QueryParam(SchemaPath.SCHEMA_PARAM) String jsonSchema) throws SchemaException { public String registerFacetSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested Facet registration with schema {}",jsonSchema); logger.trace("Requested Facet registration with schema {}",jsonSchema);
return schemaManager.registerFacetSchema(jsonSchema); return schemaManager.registerFacetSchema(jsonSchema);
} }
/** /**
* e.g. PUT /resource-registry/schema/resource?schema={...} * e.g. PUT /resource-registry/schema/resource
*
* BODY: {...}
*
* @param jsonSchema * @param jsonSchema
* @param jsonSchema * @param jsonSchema
* @return * @return
@ -68,13 +77,16 @@ public class SchemaManager {
@Path(SchemaPath.RESOURCE_PATH_PART) @Path(SchemaPath.RESOURCE_PATH_PART)
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String registerResourceSchema(@QueryParam(SchemaPath.SCHEMA_PARAM) String jsonSchema) throws SchemaException { public String registerResourceSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested Resource registration with schema {}",jsonSchema); logger.trace("Requested Resource registration with schema {}",jsonSchema);
return schemaManager.registerResourceSchema(jsonSchema); return schemaManager.registerResourceSchema(jsonSchema);
} }
/** /**
* e.g. PUT /resource-registry/schema/consistOf?schema={...} * e.g. PUT /resource-registry/schema/consistOf
*
* BODY: {...}
*
* @param jsonSchema * @param jsonSchema
* @return * @return
* @throws SchemaException * @throws SchemaException
@ -83,13 +95,16 @@ public class SchemaManager {
@Path(SchemaPath.CONSIST_OF_PATH_PART) @Path(SchemaPath.CONSIST_OF_PATH_PART)
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String registerConsistOfSchema(@QueryParam(SchemaPath.SCHEMA_PARAM) String jsonSchema) throws SchemaException { public String registerConsistOfSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested ConsistOf registration with schema {} ",jsonSchema); logger.trace("Requested ConsistOf registration with schema {} ",jsonSchema);
return schemaManager.registerConsistOfSchema(jsonSchema); return schemaManager.registerConsistOfSchema(jsonSchema);
} }
/** /**
* e.g. PUT /resource-registry/schema/relatedTo?schema={...} * e.g. PUT /resource-registry/schema/relatedTo
*
* BODY: {...}
*
* @param jsonSchema * @param jsonSchema
* @return * @return
* @throws SchemaException * @throws SchemaException
@ -98,7 +113,7 @@ public class SchemaManager {
@Path(SchemaPath.RELATED_TO_PATH_PART) @Path(SchemaPath.RELATED_TO_PATH_PART)
@Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String registerRelatedToSchema(@QueryParam(SchemaPath.SCHEMA_PARAM) String jsonSchema) throws SchemaException { public String registerRelatedToSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested RelatedTo registration with schema {} ",jsonSchema); logger.trace("Requested RelatedTo registration with schema {} ",jsonSchema);
return schemaManager.registerRelatedToSchema(jsonSchema); return schemaManager.registerRelatedToSchema(jsonSchema);
} }