com.fastchar.extjs.interceptor.FastExtGlobalInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastchar-extjs Show documentation
Show all versions of fastchar-extjs Show documentation
FastChar-ExtJs is a Java Web framework that uses extjs libraries.
package com.fastchar.extjs.interceptor;
import com.fastchar.core.FastAction;
import com.fastchar.core.FastChar;
import com.fastchar.extjs.annotation.AFastSession;
import com.fastchar.interfaces.IFastInterceptor;
public class FastExtGlobalInterceptor implements IFastInterceptor {
@Override
public void onInterceptor(FastAction fastAction) {
boolean checkSession = false;
if (fastAction.getFastRoute().getActionClass().isAnnotationPresent(AFastSession.class)) {
AFastSession annotation = fastAction.getFastRoute().getActionClass().getAnnotation(AFastSession.class);
checkSession = annotation.value();
}
if (fastAction.getFastRoute().getMethod().isAnnotationPresent(AFastSession.class)) {
AFastSession annotation = fastAction.getFastRoute().getMethod().getAnnotation(AFastSession.class);
checkSession = annotation.value();
}
if (checkSession) {
Object manager = fastAction.getSession("manager");
if (manager == null) {
fastAction.deleteAllParamFiles();
fastAction.setStatus(203).responseJson(203, "会话已失效!");
return;
}
}
fastAction.invoke();
}
}