Package org.pac4j.core.engine
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 Summary
Constructors Constructor Description AbstractExceptionAwareLogic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getErrorUrl()
protected java.lang.Object
handleException(java.lang.Exception e, HttpActionAdapter httpActionAdapter, WebContext context)
Handle exceptions.protected java.lang.RuntimeException
runtimeException(java.lang.Exception exception)
Wrap an Exception into a RuntimeException.void
setErrorUrl(java.lang.String errorUrl)
Define on which error URL the user will be redirected in case of an exception.-
Methods inherited from class org.pac4j.core.profile.factory.ProfileManagerFactoryAware
getProfileManager, getProfileManagerFactory, setProfileManagerFactory
-
-
-
-
Method Detail
-
handleException
protected java.lang.Object handleException(java.lang.Exception e, HttpActionAdapter httpActionAdapter, WebContext context)
Handle exceptions.- Parameters:
e
- the thrown exceptionhttpActionAdapter
- the HTTP action adaptercontext
- the web context- Returns:
- the final HTTP result
-
runtimeException
protected java.lang.RuntimeException runtimeException(java.lang.Exception exception)
Wrap an Exception into a RuntimeException.- Parameters:
exception
- the original exception- Returns:
- the RuntimeException
-
getErrorUrl
public java.lang.String getErrorUrl()
-
setErrorUrl
public void setErrorUrl(java.lang.String errorUrl)
Define on which error URL the user will be redirected in case of an exception.- Parameters:
errorUrl
- the error URL
-
-