Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.Session


        this.globals = globals;
    }

    public void logout( HttpServletRequest request, HttpServletResponse response, Authentication authentication ) {

        Session session = globals.getRequest().getSession( false );
        if ( null != session ) session.invalidate();
    }
View Full Code Here


        request.getSession(true).setAttribute(AUTH_TOKEN, user);
    }

    public boolean isLoggedIn()
    {
        Session session = request.getSession(false);
        if (session != null) { return session.getAttribute(AUTH_TOKEN) != null; }
        return false;
    }
View Full Code Here

        return false;
    }

    public void logout()
    {
        Session session = request.getSession(false);
        if (session != null)
        {
            session.setAttribute(AUTH_TOKEN, null);
            session.invalidate();
        }
    }
View Full Code Here

        train_getAttribute(ss, "foo", "bar");

        replay();

        Request request = new RequestImpl(sr, CHARSET, sf);
        Session session = request.getSession(true);

        assertEquals(session.getAttribute("foo"), "bar");

        verify();
    }
View Full Code Here

        replay();

        Request request = new RequestImpl(sr, CHARSET, sf);

        Session session1 = request.getSession(true);

        verify();

        hsession1.invalidate();

        expect(sr.getSession(false)).andReturn(null);

        SessionImpl session = new SessionImpl(sr, hsession2);
        expect(sf.getSession(true)).andReturn(session);
        expect(sf.getSession(true)).andReturn(session);

        replay();

        session1.invalidate();

        Session session2 = request.getSession(true);

        assertNotSame(session2, session1);
        assertSame(request.getSession(true), session2);

        verify();
View Full Code Here

        expect(hs.getAttributeNames()).andReturn(e);

        replay();

        Session session = new SessionImpl(null, hs);

        assertEquals(session.getAttributeNames("f"), Arrays.asList("fanny", "fred"));

        verify();
    }
View Full Code Here

        hs.invalidate();

        replay();

        Session session = new SessionImpl(null, hs);

        session.invalidate();

        verify();
    }
View Full Code Here

        train_getSession(hsr, false, hs);

        replay();

        Session session = new SessionImpl(hsr, hs);

        assertFalse(session.isInvalidated());

        verify();

        train_getSession(hsr, false, null);

        replay();

        assertTrue(session.isInvalidated());

        verify();

        train_getSession(hsr, false, mockHttpSession());

        replay();

        assertTrue(session.isInvalidated());

    }
View Full Code Here

        hs.setMaxInactiveInterval(seconds);

        replay();

        Session session = new SessionImpl(null, hs);

        session.setMaxInactiveInterval(seconds);

        verify();
    }
View Full Code Here

        expect(hs.getMaxInactiveInterval()).andReturn(seconds);

        replay();

        Session session = new SessionImpl(null, hs);

        assertEquals(session.getMaxInactiveInterval(), seconds);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.