I have a filter which I want to check to see if the user is authenticated every time a page is requested from within a specific url '/pages/*' and if not redirect to '/login.jsp'. I've written a filter which works and applied it to the url but the first time I request a page it doesn't check.
My welcome page is '/index.jsp' and it just contains a jsp:forward to '/pages/main.jsp'. The filter should apply to the request for 'main.jsp' but it doesn't. The page loads and only when I try to go somewhere else or reload the page do I get redirected to 'login.jsp' like I want to. I don't think it has to do with the jsp:forward because I can type in a url for a specific page that should cause a redirect but the same thing happens.
Does anyone know why this isn't working?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35252
7
posted
0
Is the filter configured so that it gets used for all kinds of accesses? Under a Servlet 2.4-compatible container you can use the <dispatcher> element in web.xml to control this.