Class CatchAllExceptionHandlerControllerAdvice
java.lang.Object
it.uniroma2.art.semanticturkey.mvc.CatchAllExceptionHandlerControllerAdvice
ControllerAdvice that handles the exception thrown by Semantic Turkey services (published using the MVC
framework). The HTTP status is 200 OK (at the communication protocol level), while the response body is an
XML representation of the error (at the application level).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String>
handleException
(jakarta.validation.ConstraintViolationException ex, jakarta.servlet.http.HttpServletRequest request) org.springframework.http.ResponseEntity<String>
handleException
(Exception ex, jakarta.servlet.http.HttpServletRequest request) void
handleException
(org.springframework.security.access.AccessDeniedException ex, jakarta.servlet.http.HttpServletRequest request) In st-core-services some methods are secured with @PreAuthorized annotation.org.springframework.http.ResponseEntity<String>
handleException
(org.springframework.transaction.TransactionSystemException ex, jakarta.servlet.http.HttpServletRequest request) void
onSettingsUpdated
(SettingsEvent event)
-
Field Details
-
exptMgr
-
-
Constructor Details
-
CatchAllExceptionHandlerControllerAdvice
public CatchAllExceptionHandlerControllerAdvice()
-
-
Method Details
-
onSettingsUpdated
-
getErrorReportingSettings
-
handleException
@ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) public void handleException(org.springframework.security.access.AccessDeniedException ex, jakarta.servlet.http.HttpServletRequest request) In st-core-services some methods are secured with @PreAuthorized annotation. When an authenticated user that has no enough privileges try to access the method, an AccessDeniedException is thrown. This exception should be handled by STAccessDeniedHandler (a custom AccessDeniedHandler). The following ExceptionHandler prevent @ExceptionHandler(Exception.class) from catching the AccessDeniedException and simply re-throw it so that it bubble up until the STAccessDeniedHandler- Parameters:
ex
-request
-
-
handleException
@ExceptionHandler(org.springframework.transaction.TransactionSystemException.class) public org.springframework.http.ResponseEntity<String> handleException(org.springframework.transaction.TransactionSystemException ex, jakarta.servlet.http.HttpServletRequest request) -
handleException
@ExceptionHandler(jakarta.validation.ConstraintViolationException.class) public org.springframework.http.ResponseEntity<String> handleException(jakarta.validation.ConstraintViolationException ex, jakarta.servlet.http.HttpServletRequest request) -
handleException
@ExceptionHandler(java.lang.Exception.class) public org.springframework.http.ResponseEntity<String> handleException(Exception ex, jakarta.servlet.http.HttpServletRequest request)
-