Class ApiController

java.lang.Object
edu.ucsb.cs156.organic.controllers.ApiController
Direct Known Subclasses:
CoursesController, JobsController, StudentsController, SystemInfoController, UserInfoController, UsersController

public abstract class ApiController extends Object
  • Constructor Details

    • ApiController

      public ApiController()
  • Method Details

    • getCurrentUser

      protected CurrentUser getCurrentUser()
    • handleIllegalArgumentException

      @ExceptionHandler(java.lang.IllegalArgumentException.class) @ResponseStatus(BAD_REQUEST) public Object handleIllegalArgumentException(Throwable e)
    • handleGenericException

      @ExceptionHandler(EntityNotFoundException.class) @ResponseStatus(NOT_FOUND) public Object handleGenericException(Throwable e)
    • getMapper

      public com.fasterxml.jackson.databind.ObjectMapper getMapper()
      Special ObjectMapper that ignores Mockito mocks
      Returns:
      ObjectMapper mapper
    • genericMessage

      protected Object genericMessage(String message)
    • mapperThatIgnoresMockitoMocks

      public static com.fasterxml.jackson.databind.ObjectMapper mapperThatIgnoresMockitoMocks()
    • handleAccessDeniedException

      @ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) @ResponseStatus(FORBIDDEN) public Object handleAccessDeniedException(Throwable err)