有没有哪位大神碰到过类似的问题?
如何解决?
拦截器:
@Override public void intercept(Invocation inv) { Controller c = inv.getController(); HttpSession hs = c.getSession(false); if(XX.isEmpty(hs) || XX.isEmpty(c.getSessionAttr("user"))){ c.redirect("/login/view"); return; } Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date overdue = null; try { overdue = sdf.parse(c.getSessionAttr("overdue")); } catch (ParseException e) { e.printStackTrace(); ErrRender.auto(c, 401); return; } if(overdue.getTime() < now.getTime()){ if(XX.isAjax(inv.getController().getRequest())){ String msg = "登录超时,请重新登录!"; if(XX.isJsonRender(inv.getController().getRequest())){ c.renderJson(Kv.by("errCode", 1).set("msg", msg)); }else{ c.setAttr("msg", msg); c.render("/jfast/login/loginError.html"); } }else{ c.redirect("/login/view"); } return; }else{ Long interval = c.getSessionAttr("interval"); Long endTime = now.getTime() + interval*1000; String res = sdf.format(endTime); c.setSessionAttr("overdue", res); } inv.invoke(); }
登录控制器:
public class LoginController extends Controller{ private String userName = ""; private String userPwd = ""; private JfastUser user = new JfastUser(); private String login_time = "";//登录时间:yyyy-MM-dd HH:mm:ss public SqlPara sqlPara = new SqlPara(); /** * 登录页 */ @Clear(LoginGlobeInterceptor.class) public void view(){ render("/jfast/login/login.html"); } …… }
查了半天,才发现,原来是360浏览器的“阅读模式”这个插件搞的鬼!!!,禁用就行了!(禁用后可以再次开启。)
郁闷!
项目:JFinal