jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuhito SUGURI <suguri.kazuh...@lab.ntt.co.jp>
Subject Re: FilterRedirector does not initialize sessions. - IS THIS A BUG ??
Date Wed, 10 Nov 2004 12:40:16 GMT
Hi,

In article <200411100929.iAA9TjPn012009@tama5.ecl.ntt.co.jp>,
Wed, 10 Nov 2004 10:24:49 +0100,
"Vincent Massol" <vmassol@pivolis.com> wrote: 
vmassol> Are you sure your SessionFilter is a real Filter? It looks like you're not
vmassol> extending the Filter interface. The second problem I can see is that you're
vmassol> completely bypassing the filter initialization in your init() method (I
vmassol> think it is safer to call super.init(filterConfig)).
vmassol> 
vmassol> Have you registered the filter as a filter in the web.xml file?

I believe, Pedro is expecting that following two tests should be passed:
    public class SessionServletTest extends ServletTestCase {
        ....
        public void beginSession(WebRequest request) {
            request.setAutomaticSession(true);
        }

        public void testSession() {
            assertNotNull("There should be a session", session);
        }
    }

    public class SessionFilterTest extends FilterTestCase {
        ....
        public void beginSession(WebRequest request) {
            request.setAutomaticSession(true);
        }

        public void testSession() {
            HttpSession session = request.getSession(false);
            assertNotNull("There should be a session", session);
        }
    }

Am I misunderstanding, Pedro?

I cannot try it now, but, SessionFilterTest#testSession() may fails.
An HTTP Session is created to fill the session implicit object
of ServletTestCase (and of JspTestCase) prior to testXXX.
However, for FilterTestCase, which doesn't have the session implicit object,
such session creation is not needed and is not implemented, AFAIK.

Regards,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp

Mime
View raw message