보호하고자하는 페이지에 대해 인증 필터를 구성했습니다.JSF 리디렉션은 필터에서 예외를 발생시킵니다.
com.sun.faces.context.FacesFileNotFoundException
는 로그인 페이지로 리디렉션 할 때 그러나, 나는 오류가 아래에 발생하고하는 것은 ..here 내 필터
@WebFilter(filterName = "Authentication Filter", urlPatterns = { "/pages/*" }, dispatcherTypes = {
DispatcherType.REQUEST, DispatcherType.FORWARD })
public class AuthenticationFilter implements Filter {
static final Logger logger = Logger.getLogger(AuthenticationFilter.class);
private String contextPath;
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
if (httpRequest.getUserPrincipal() == null) {
httpResponse.sendRedirect(contextPath
+ "/faces/pages/public/login.xhtml");
return;
}
chain.doFilter(request, response);
}
public void init(FilterConfig fConfig) throws ServletException {
contextPath = fConfig.getServletContext().getContextPath();
}
}
입니다 .. 그리고 내 web.xml 파일은이 코드로 매핑됩니다 면 서블릿
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
확실하지하지만 난 경로 내 프로젝트 폴더에 존재하는 것을 확인했습니다
+pages
+public
-login.xhtml
생성 된 경로는
http://localhost:8080/MyApp/faces/pages/public/login.xhtml
누구는 이유를 알고있다?