Fixed client error from 400 Bad Request to 405 Method Not Allowed

This commit is contained in:
Luca Frosini 2019-09-06 16:55:46 +02:00
parent a5bdbc6500
commit a7f35422c9
1 changed files with 3 additions and 3 deletions

View File

@ -1,12 +1,12 @@
package org.gcube.gcat.rest;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.NotAllowedException;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@ -87,7 +87,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
setCalledMethod("PUT /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
try {
if(name.compareToIgnoreCase(SCHEMA)==0) {
throw new BadRequestException("You cannot manage the profile schema");
throw new NotAllowedException("You cannot manage the profile schema");
}
ISProfile isProfile = new ISProfile();
boolean created = isProfile.createOrUpdate(name, xml);
@ -113,7 +113,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
setCalledMethod("DELETE /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
try {
if(name.compareToIgnoreCase(SCHEMA)==0) {
throw new BadRequestException("You cannot manage the profile schema");
throw new NotAllowedException("You cannot manage the profile schema");
}
ISProfile isProfile = new ISProfile();
isProfile.delete(name);