Package org.pac4j.core.engine
Class AbstractExceptionAwareLogic<R,C extends WebContext>
- java.lang.Object
-
- org.pac4j.core.profile.factory.ProfileManagerFactoryAware<C>
-
- org.pac4j.core.engine.AbstractExceptionAwareLogic<R,C>
-
- Direct Known Subclasses:
DefaultCallbackLogic
,DefaultLogoutLogic
,DefaultSecurityLogic
public abstract class AbstractExceptionAwareLogic<R,C extends WebContext> extends ProfileManagerFactoryAware<C>
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
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description AbstractExceptionAwareLogic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getErrorUrl()
protected R
handleException(Exception e, HttpActionAdapter<R,C> httpActionAdapter, C context)
Handle exceptions.protected RuntimeException
runtimeException(Exception exception)
Wrap an Exception into a RuntimeException.void
setErrorUrl(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 R handleException(Exception e, HttpActionAdapter<R,C> httpActionAdapter, C context)
Handle exceptions.- Parameters:
e
- the thrown exceptionhttpActionAdapter
- the HTTP action adaptercontext
- 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
-
-