@@ -0,0 +1,1011 @@
+package org.owasp.appsensor.exception;%0A%0Aimport org.owasp.appsensor.core.exceptions.NotAuthorizedException;%0Aimport org.springframework.dao.DataIntegrityViolationException;%0Aimport org.springframework.http.HttpStatus;%0Aimport org.springframework.web.bind.annotation.ControllerAdvice;%0Aimport org.springframework.web.bind.annotation.ExceptionHandler;%0Aimport org.springframework.web.bind.annotation.ResponseStatus;%0A%0A@ControllerAdvice%0Aclass GlobalControllerExceptionHandler %7B%0A    %0A%09@ResponseStatus(HttpStatus.CONFLICT)  // 409%0A    @ExceptionHandler(DataIntegrityViolationException.class)%0A    public void handleConflict() %7B%0A        // Nothing to do%0A    %7D%0A    %0A    @ResponseStatus(HttpStatus.UNAUTHORIZED)  // 401%0A    @ExceptionHandler(NotAuthorizedException.class)%0A    public void handleUnauthorized() %7B%0A        // Nothing to do%0A    %7D%0A    %0A    @ResponseStatus(HttpStatus.BAD_REQUEST)  // 400%0A    @ExceptionHandler(IllegalArgumentException.class)%0A    public void handleBadRequest() %7B%0A        // Nothing to do%0A    %7D%0A    %0A%7D

add global exception handler for restful responses