I have done a Filter in Java, but I want to exclude the ForgotPassword.xhtml file besides the index.xhtml, where do I have put the xhtml name to exclude it?
public class LoginFilter implements Filter {
.........
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
...................
if (noProteger(urlStr)) {
chain.doFilter(request, response);
return;
}
if (usuarioBean == null || !usuarioBean.estaLogeado()) {
res.sendRedirect(req.getContextPath() + "/index.xhtml");
return;
}
chain.doFilter(request, response);
}
public void init(FilterConfig fConfig) throws ServletException {
}
private boolean noProteger(String urlStr) {
if (urlStr.endsWith("index.xhtml"))
return true;
if (urlStr.indexOf("/javax.faces.resource/") != -1)
return true;
return false;
}
}
If you all could help me, I will be so thankful
Aucun commentaire:
Enregistrer un commentaire