| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.fgkj.actions.ActionUtil;
|
| | | import com.fgkj.dao.CheckMobile;
|
| | | import com.fgkj.dto.User;
|
| | | import com.fgkj.dto.User_inf;
|
| | | import com.fgkj.dto.Vip_user;
|
| | |
| | | //System.out.println(source);
|
| | | User_inf user=(User_inf)ActionUtil.getSession().getAttribute("user");
|
| | | Vip_user vuser=(Vip_user)ActionUtil.getSession().getAttribute("vip");
|
| | | if(source.equals("login.jsp") || source.equals("fuguang") || source.equals("CheckClient.jsp")){
|
| | | if(("login.jsp").equals(source)|| ("loginm.html").equals(source) || ("gx_tieta").equals(source) || ("CheckClient.jsp").equals(source)){
|
| | | chain.doFilter(req, resp);
|
| | | }else if(user!=null && !source.equals("navConfig.jsp")){
|
| | | chain.doFilter(req, resp);
|
| | |
| | | }else{
|
| | | //System.out.println("还未登陆请登陆 LoginFilter");
|
| | | PrintWriter out=ActionUtil.getOut();
|
| | | out.print("<script charset='UTF-8'>window.location.href='login.jsp'</script>");
|
| | | //判断当前登陆的是手机端还是web端
|
| | | if(CheckIsMobile(request)){
|
| | | out.print("<script charset='UTF-8'>window.location.href='loginm.html'</script>");
|
| | | }else{ |
| | | out.print("<script charset='UTF-8'>window.location.href='login.jsp'</script>");
|
| | | } |
| | | //out.print("<script charset='UTF-8'>alert('"+getText("You are not logged in, please log in")+"');window.location.href='login.jsp'</script>");
|
| | | }
|
| | | }
|
| | |
| | | //System.out.println("初始化过滤器");
|
| | | }
|
| | |
|
| | | |
| | | public static boolean CheckIsMobile(HttpServletRequest request){
|
| | | String userAgent = getRequest().getHeader( "USER-AGENT" ).toLowerCase(); |
| | | if(null == userAgent){ |
| | | userAgent = ""; |
| | | } |
| | | return CheckMobile.check(userAgent); |
| | | }
|
| | | }
|