Class AbstractExceptionHandler<T extends Throwable>

java.lang.Object
org.eclipse.dirigible.commons.api.service.AbstractExceptionHandler<T>
Type Parameters:
T - the generic type
All Implemented Interfaces:
javax.ws.rs.ext.ExceptionMapper<T>

public abstract class AbstractExceptionHandler<T extends Throwable>
extends Object
implements javax.ws.rs.ext.ExceptionMapper<T>
The AbstractExceptionHandler is the parent of the exception handlers in RESTful services.
  • Constructor Details

  • Method Details

    • toResponse

      public javax.ws.rs.core.Response toResponse​(T exception)
      To response.
      Specified by:
      toResponse in interface javax.ws.rs.ext.ExceptionMapper<T extends Throwable>
      Parameters:
      exception - the exception
      Returns:
      the response
    • logErrorMessage

      protected void logErrorMessage​(org.slf4j.Logger logger, T exception)
      Log error message.
      Parameters:
      logger - the logger
      exception - the exception
    • getType

      public abstract Class<? extends AbstractExceptionHandler<T>> getType()
      Gets the type.
      Returns:
      the type
    • getLogger

      protected abstract org.slf4j.Logger getLogger()
      Gets the logger.
      Returns:
      the logger
    • getResponseStatus

      protected abstract javax.ws.rs.core.Response.Status getResponseStatus​(T exception)
      Gets the response status.
      Parameters:
      exception - the exception
      Returns:
      the response status
    • getResponseMessage

      protected abstract String getResponseMessage​(T exception)
      Gets the response message.
      Parameters:
      exception - the exception
      Returns:
      the response message