@Override public Response toResponse(@SuppressWarnings("unused") NoAuthorizationException exception) { // Status code 403 really reads as: "Authenticated - but not authorized": return Response.status(Status.FORBIDDEN) .entity(ApiGlobalErrorResponse.unAuthorized()) .type(MediaType.APPLICATION_JSON) .build(); }
@Override public Response toResponse(AbstractPlatformResourceNotFoundException exception) { ApiGlobalErrorResponse notFoundErrorResponse = ApiGlobalErrorResponse.notFound( exception.getGlobalisationMessageCode(), exception.getDefaultUserMessage(), exception.getDefaultUserMessageArgs()); return Response.status(Status.NOT_FOUND) .entity(notFoundErrorResponse) .type(MediaType.APPLICATION_JSON) .build(); }