Class ExceptionControllerAdvice
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.web.controlleradvice.ExceptionControllerAdvice
-
@ControllerAdvice public class ExceptionControllerAdvice extends java.lang.Object
Handles exceptions thrown by all of the controllers
-
-
Constructor Summary
Constructors Constructor Description ExceptionControllerAdvice()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
notAjaxRequest(NotAjaxRequest e)
Handles requests which are only allowed to be ajax requests.java.lang.String
notAuthorisedError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all requests which are not authorisedjava.lang.String
notFoundError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all "not found" errorsjava.lang.String
notInitialised(org.springframework.ui.Model model, java.lang.Exception e)
Handles requests which occur before Spring has finished starting upjava.lang.String
runtimeError(org.springframework.ui.Model model, java.lang.Exception e)
Handles all generic/unknown errorsjava.lang.String
uploadSizeExceededError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all requests where the user tried to upload files that are larger than allowed
-
-
-
Method Detail
-
notInitialised
@ExceptionHandler(SpringNotInitialised.class) @ResponseStatus(SERVICE_UNAVAILABLE) public java.lang.String notInitialised(org.springframework.ui.Model model, java.lang.Exception e)
Handles requests which occur before Spring has finished starting up- Parameters:
model
- holder for model attributese
- the exception object- Returns:
- the path to the error page
-
notAjaxRequest
@ExceptionHandler(NotAjaxRequest.class) public java.lang.String notAjaxRequest(NotAjaxRequest e)
Handles requests which are only allowed to be ajax requests. Redirects the user to the url supplied in the error message, typically this is the page that contained the form/page element- Parameters:
e
- the exception object- Returns:
- the page to redirect to
-
runtimeError
@ExceptionHandler({java.lang.Throwable.class,LoadingHelpFailed.class}) @ResponseStatus(INTERNAL_SERVER_ERROR) public java.lang.String runtimeError(org.springframework.ui.Model model, java.lang.Exception e)
Handles all generic/unknown errors- Parameters:
model
- holder for model attributese
- the exception object- Returns:
- the path to the error page
-
notFoundError
@ExceptionHandler({IWorkspaceNotFound.class,WorkspaceNotFound.class,TemplateNotFound.class,SubmissionNotFound.class,DetectorNotFound.class,ResultsNotFound.class,SourceFileNotFound.class,AccountNotFound.class,CompareSameSubmission.class}) @ResponseStatus(NOT_FOUND) public java.lang.String notFoundError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all "not found" errors- Parameters:
model
- holder for model attributesauthentication
- the authentication classe
- the exception object- Returns:
- the path to the error page
-
notAuthorisedError
@ExceptionHandler({NotTemplateOwner.class,AccountOwner.class}) @ResponseStatus(FORBIDDEN) public java.lang.String notAuthorisedError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all requests which are not authorised- Parameters:
model
- holder for model attributesauthentication
- the authentication classe
- the exception object- Returns:
- the path to the error page
-
uploadSizeExceededError
@ExceptionHandler(org.springframework.web.multipart.MaxUploadSizeExceededException.class) @ResponseStatus(PAYLOAD_TOO_LARGE) public java.lang.String uploadSizeExceededError(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication, java.lang.Exception e)
Handles all requests where the user tried to upload files that are larger than allowed- Parameters:
model
- holder for model attributesauthentication
- the authentication classe
- the exception object- Returns:
- the path to the error page
-
-