I was trying to make a filter to stop users who are not logged in from accessing certain pages.For this i made a filter class with the following doFilter method
I think you have to change your web.xml... You have to put your restricted resources to appropriate folder. In this way Filter Servlet will restrict files which allocates in "restricted" folder.(http://www.developer.com/security/article.php/3467801/Securing-J2EE-Applications-with-a-Servlet-Filter.htm) (And I think the reason of using Filter Servlet is writing own Authorization system. - in this way you have not to define your Security Constraints in the web.xml, you have to define it in Data Base ;))) )
AuthorizationFilter
examples.AuthorizationFilter
This Filter authorizes user access to application
components based upon request URI.
error_page
../../login.html
AuthorizationFilter
/restricted/*