我正在尝试从应用程序重定向到登录页面。 我注意到在网络流量中,针对该页面返回的登录地址未在导航器级别显示( 看到图片作为附件)
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
System.out.println("doFilter");
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
Utilisateur user = (Utilisateur) httpRequest.getSession().getAttribute(ConstantesPrixCarb.ATT_USER);
System.out.println(httpRequest.getRequestURI());
if (user == null) {
httpResponse.sendRedirect(System.getProperty("url.login.page"));
return;
} else {
chain.doFilter(request, response);
}
}