Hi,

 

I am trying to write a very simple security filter to redirect the user to the login page if he/she is not login, something like the following:

 

            public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)

                                    throws IOException, ServletException {

 

                        if (!authenticated((HttpServletRequest)req)) {

                                    ((HttpServletRequest)req).getRequestDispatcher(“/login.jsf”).forward(req, res);

                        } else {

                                    chain.doFilter(req, res);

                        }

            }

 

But I seems to be having problems with getRequestDispatcher(“/login.jsf”).forward().

The login.jsf got forwarded to OK, however the JSF engine seems to get very confused afterwards. The URL shown in the browser window is of the following form:

 

http://localhost:8080/myapp/login.jsf;jsessionid=46D86B99BE29C1F112F1C8BD3CBA6D6D

 

and nothing works till I logon via the login page directly.

 

Anyway around this?

 

Many thanks in advance.

 

Yee

Reply via email to