Class AbstractExceptionAwareLogic

java.lang.Object
org.pac4j.core.profile.factory.ProfileManagerFactoryAware
org.pac4j.core.engine.AbstractExceptionAwareLogic
Direct Known Subclasses:
DefaultCallbackLogic, DefaultLogoutLogic, DefaultSecurityLogic

public abstract class AbstractExceptionAwareLogic extends ProfileManagerFactoryAware

Abstract logic to handle exceptions:

  • if it's a HttpAction, the HTTP action (which has already been performed on the web context) is "adapted"
  • else if an errorUrl is defined, the user is redirected to this error URL
  • otherwise the exception is thrown again
Since:
3.0.0
Author:
Jerome Leleu
  • Constructor Details

    • AbstractExceptionAwareLogic

      public AbstractExceptionAwareLogic()
  • Method Details

    • handleException

      protected Object handleException(Exception e, HttpActionAdapter httpActionAdapter, WebContext context)
      Handle exceptions.
      Parameters:
      e - the thrown exception
      httpActionAdapter - the HTTP action adapter
      context - the web context
      Returns:
      the final HTTP result
    • runtimeException

      protected RuntimeException runtimeException(Exception exception)
      Wrap an Exception into a RuntimeException.
      Parameters:
      exception - the original exception
      Returns:
      the RuntimeException
    • getErrorUrl

      public String getErrorUrl()
    • setErrorUrl

      public void setErrorUrl(String errorUrl)
      Define on which error URL the user will be redirected in case of an exception.
      Parameters:
      errorUrl - the error URL