Fixing exception mapper response code
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146733 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8a20df8e90
commit
4eca4513da
|
@ -67,7 +67,7 @@ public class Access {
|
|||
@GET
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String query(@QueryParam(AccessPath.QUERY_PARAM) String query,
|
||||
@QueryParam(AccessPath.LIMIT_PARAM) int limit,
|
||||
@QueryParam(AccessPath.LIMIT_PARAM) Integer limit,
|
||||
@QueryParam(AccessPath.FETCH_PLAN_PARAM) String fetchPlan)
|
||||
throws InvalidQueryException {
|
||||
logger.info("Requested query (fetch plan {}, limit : {}):\n{}",
|
||||
|
|
|
@ -8,6 +8,7 @@ import javax.ws.rs.ext.Provider;
|
|||
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERAvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
|
||||
|
||||
/**
|
||||
|
@ -23,8 +24,10 @@ public class ResourceRegistryExceptionMapper implements ExceptionMapper<Resource
|
|||
|
||||
if(ERNotFoundException.class.isAssignableFrom(exception.getClass())){
|
||||
status = Status.NOT_FOUND;
|
||||
}else if(ERAlreadyPresentException.class.isAssignableFrom(exception.getClass())){
|
||||
status = Status.FORBIDDEN;
|
||||
} else if(ERAlreadyPresentException.class.isAssignableFrom(exception.getClass())){
|
||||
status = Status.CONFLICT;
|
||||
} else if(ERAvailableInAnotherContextException.class.isAssignableFrom(exception.getClass())){
|
||||
status = Status.CONFLICT;
|
||||
} else if(exception.getClass() == ResourceRegistryException.class){
|
||||
status = Status.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue