| 1234567891011121314151617181920 |
- package common.interceptor;
- import com.jfinal.aop.Interceptor;
- import com.jfinal.aop.Invocation;
- import com.jfinal.core.Controller;
- import common.utils.http.MyRet;
- public class ExceptionInterceptor implements Interceptor {
- @Override
- public void intercept(Invocation inv) {
- try {
- inv.invoke();
- } catch (Exception e) {
- e.printStackTrace();
- Controller c = inv.getController();
- c.renderJson(MyRet.create().setFail().setMsg(e.getMessage()));
- }
- }
- }
|