Class ApiController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
Direct Known Subclasses:
RestaurantsController, SystemInfoController, UCSBDatesController, UCSBDiningCommonsController, UserInfoController, UsersController

public abstract class ApiController extends Object
This is an abstract class that provides common functionality for all API controllers.
  • Constructor Details

    • ApiController

      public ApiController()
  • Method Details

    • getCurrentUser

      protected CurrentUser getCurrentUser()
      This method returns the current user.
      Returns:
      the current user
    • genericMessage

      protected Object genericMessage(String message)
      This method returns a generic message.
      Parameters:
      message - the message
      Returns:
      a map with the message
    • handleGenericException

      @ExceptionHandler(EntityNotFoundException.class) @ResponseStatus(NOT_FOUND) public Object handleGenericException(Throwable e)
      This method handles the EntityNotFoundException.
      Parameters:
      e - the exception
      Returns:
      a map with the type and message of the exception