Package spark

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 Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Class<? extends T>
    Holds the type of exception that this filter will handle
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExceptionHandlerImpl(Class<T> exceptionClass)
    Initializes the filter with the provided exception type
  • Method Summary

    Modifier and Type
    Method
    Description
    Class<? extends T>
    Returns type of exception that this filter will handle
    void
    exceptionClass(Class<? extends T> exceptionClass)
    Sets the type of exception that this filter will handle
    abstract void
    handle(T exception, Request request, Response response)
    Invoked when an exception that is mapped to this handler occurs during routing

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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