package org.gcube.data_catalogue.grsf_publish_ws.ex; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @Provider /** * Exception thrown when @Valid fail * @author Costantino Perciante at ISTI-CNR */ public class ApplicationException implements ExceptionMapper { public Response toResponse(Exception e) { return Response .status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) .type(MediaType.APPLICATION_JSON) .entity(e.getMessage()) .build(); } }