Class DSpaceApiExceptionControllerAdvice


  • @ControllerAdvice
    public class DSpaceApiExceptionControllerAdvice
    extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
    This Controller advice will handle all exceptions thrown by the DSpace API module
    Author:
    Tom Desair (tom dot desair at atmire dot com), Frederic Van Reet (frederic dot vanreet at atmire dot com), Andrea Bollini (andrea.bollini at 4science.it), Pasquale Cavallo (pasquale.cavallo at 4science dot it)
    • Field Summary

      • Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void handleAuthorizeException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void handleGenericException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void handleIOException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected org.springframework.http.ResponseEntity<Object> handleMissingServletRequestParameter​(org.springframework.web.bind.MissingServletRequestParameterException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)  
      protected void handleSQLException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected org.springframework.http.ResponseEntity<Object> handleTypeMismatch​(org.springframework.beans.TypeMismatchException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)  
      protected void handleUnprocessableEntityException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void handleWrongRequestException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void methodNotAllowedException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void MissingParameterException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      protected void ParameterConversionException​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception ex)  
      • Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleExceptionInternal, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException
    • Constructor Detail

      • DSpaceApiExceptionControllerAdvice

        public DSpaceApiExceptionControllerAdvice()
    • Method Detail

      • handleAuthorizeException

        @ExceptionHandler({org.dspace.authorize.AuthorizeException.class,RESTAuthorizationException.class,org.springframework.security.access.AccessDeniedException.class})
        protected void handleAuthorizeException​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response,
                                                Exception ex)
                                         throws IOException
        Throws:
        IOException
      • ParameterConversionException

        @ExceptionHandler(org.springframework.data.repository.support.QueryMethodParameterConversionException.class)
        protected void ParameterConversionException​(javax.servlet.http.HttpServletRequest request,
                                                    javax.servlet.http.HttpServletResponse response,
                                                    Exception ex)
                                             throws IOException
        Throws:
        IOException
      • handleMissingServletRequestParameter

        protected org.springframework.http.ResponseEntity<Object> handleMissingServletRequestParameter​(org.springframework.web.bind.MissingServletRequestParameterException ex,
                                                                                                       org.springframework.http.HttpHeaders headers,
                                                                                                       org.springframework.http.HttpStatus status,
                                                                                                       org.springframework.web.context.request.WebRequest request)
        Overrides:
        handleMissingServletRequestParameter in class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
      • handleTypeMismatch

        protected org.springframework.http.ResponseEntity<Object> handleTypeMismatch​(org.springframework.beans.TypeMismatchException ex,
                                                                                     org.springframework.http.HttpHeaders headers,
                                                                                     org.springframework.http.HttpStatus status,
                                                                                     org.springframework.web.context.request.WebRequest request)
        Overrides:
        handleTypeMismatch in class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler