Class ExceptionHandlerImpl<T extends Exception>

java.lang.Object
spark.ExceptionHandlerImpl<T>
All Implemented Interfaces:
ExceptionHandler<T>

public abstract class ExceptionHandlerImpl<T extends Exception> extends Object implements ExceptionHandler<T>
  • Field Details

    • exceptionClass

      protected Class<? extends T extends Exception> exceptionClass
      Holds the type of exception that this filter will handle
  • Constructor Details

    • ExceptionHandlerImpl

      public ExceptionHandlerImpl(Class<T> exceptionClass)
      Initializes the filter with the provided exception type
      Parameters:
      exceptionClass - Type of exception
  • Method Details

    • exceptionClass

      public Class<? extends T> exceptionClass()
      Returns type of exception that this filter will handle
      Returns:
      Type of exception
    • exceptionClass

      public void exceptionClass(Class<? extends T> exceptionClass)
      Sets the type of exception that this filter will handle
      Parameters:
      exceptionClass - Type of exception
    • handle

      public abstract void handle(T exception, Request request, Response response)
      Invoked when an exception that is mapped to this handler occurs during routing
      Specified by:
      handle in interface ExceptionHandler<T extends Exception>
      Parameters:
      exception - The exception that was thrown during routing
      request - The request object providing information about the HTTP request
      response - The response object providing functionality for modifying the response