⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 authorizationauthenticationinterceptor.java

📁 pojo的mvc框架
💻 JAVA
字号:
package xyz.frame.plugin.login;import xyz.frame.Interceptor;import xyz.frame.LogicException;import xyz.frame.LogicFlow;import xyz.frame.RedirectException;import xyz.frame.view.ViewException;/** * An interceptor capable of redirecting flow in case an authorization or * authentication exception occurs *  * @author Guilherme Silveira */public class AuthorizationAuthenticationInterceptor implements Interceptor {	/**	 * Intercepts and in case of a authentication, authorization exception	 * redirects to some pre-defined logic	 * 	 * @see xyz.frame.Interceptor#intercept(xyz.frame.LogicFlow)	 */	public void intercept(LogicFlow flow) throws LogicException, ViewException {		try {			flow.execute();		} catch (LogicException ex) {			Throwable cause = ex.getCause();			try {				if (cause instanceof AuthenticationException) {					// login/failed.authentication.jsp --> login form					flow.redirect("/login.form.logic?what=authentication");				} else if (cause instanceof AuthorizationException) {					flow.redirect("/login.failed.logic?what=authorization");				}			} catch (RedirectException e) {				throw new LogicException(e.getMessage(), e.getCause());			}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -