|
|
|
@ -9,7 +9,7 @@ import java.io.IOException;
|
|
|
|
|
@WebFilter(filterName = "sessionFilter",urlPatterns = {"/*"})
|
|
|
|
|
public class S_Filter implements Filter {
|
|
|
|
|
String NO_LOGIN="/notLogin";
|
|
|
|
|
String[] includeUrls=new String[]{"redirect:http://localhost:8080/firstproject/demo/Front-end/Login/Login.html","redirect:http://localhost:8080/firstproject/demo/Front-end/Login/Login1.html"};
|
|
|
|
|
String includeUrls="/gdms/login.jsp";
|
|
|
|
|
@Override
|
|
|
|
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException,IOException{
|
|
|
|
|
HttpServletRequest request=(HttpServletRequest) servletRequest;
|
|
|
|
@ -32,7 +32,7 @@ public class S_Filter implements Filter {
|
|
|
|
|
response.sendRedirect(NO_LOGIN);
|
|
|
|
|
}else{
|
|
|
|
|
//重定向到登录页(需要在static文件夹下建立此html文件)
|
|
|
|
|
response.sendRedirect(request.getContextPath()+"redirect:http://localhost:8080/firstproject/demo/Front-end/Login/Login.html");
|
|
|
|
|
response.sendRedirect("/gdms/login.jsp");
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -41,11 +41,9 @@ public class S_Filter implements Filter {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public boolean isNeedFilter(String uri) {
|
|
|
|
|
for (String includeUrl : includeUrls) {
|
|
|
|
|
if (includeUrl.equals(uri)) {
|
|
|
|
|
if (includeUrls.equals(uri)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|