I have created a filter login How to redirect a logged out user to the home page in Java EE/JSF?
But now I want to set just some specific pages have to login. I created some pages and put them into private folder, and changed the filter's url like this
<filter-name>AuthenticationLogin</filter-name>
<filter-class>filter.AuthenticationLogin</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationLogin</filter-name>
<url-pattern>/private/*</url-pattern>
</filter-mapping>
It doesn't work :(
Any suggestion. Thanks in advance.
Your filter mapping is correct. You can use following redirection
response.sendRedirect(request.getContextPath() + "/login.jsf");
in filter.