Package org.apache.tapestry.web

Examples of org.apache.tapestry.web.WebSession


    public void store(String objectName, Object stateObject)
    {
        String key = buildKey(objectName);

        WebSession session = getSession();

        session.setAttribute(key, stateObject);
    }
View Full Code Here


        // Only perform the stateful check if the application was stateful
        // when the URL was rendered.

        if (activeSession && action.getRequiresSession())
        {
            WebSession session = _request.getSession(false);

            if (session == null || session.isNew())
                throw new StaleSessionException(EngineMessages.requestStateSession(component),
                        componentPage);

        }
View Full Code Here

    }

    private WebSession newSession(String attributeName, Object value)
    {
        MockControl control = newControl(WebSession.class);
        WebSession session = (WebSession) control.getMock();

        session.getAttributeNames();

        control.setReturnValue(Collections.singletonList(attributeName));

        if (value != null)
        {
            session.getAttribute(attributeName);
            control.setReturnValue(value);
        }

        return session;
    }
View Full Code Here

    }

    private WebSession newSession(String attributeName, boolean remove)
    {
        MockControl control = newControl(WebSession.class);
        WebSession session = (WebSession) control.getMock();

        session.getAttributeNames();

        control.setReturnValue(Collections.singletonList(attributeName));

        if (remove)
            session.setAttribute(attributeName, null);

        return session;
    }
View Full Code Here

        return session;
    }

    public void testStorePageProperty()
    {
        WebSession session = newSession();
        WebRequest request = newRequest(true, session);

        Object value = new Object();

        session.setAttribute("myapp,Home,foo", value);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

        verifyControls();
    }

    public void testClearPageProperty()
    {
        WebSession session = newSession();
        WebRequest request = newRequest(true, session);

        session.setAttribute("myapp,Help,bar", null);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

        verifyControls();
    }

    public void testStoreComponentProperty()
    {
        WebSession session = newSession();
        WebRequest request = newRequest(true, session);

        Object value = new Object();

        session.setAttribute("gloop,Nerf,zip.zap,spaz", value);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

        verifyControls();
    }

    public void testGetStoreChangesNoMatch()
    {
        WebSession session = newSession("myapp,Home,foo,bar", null);
        WebRequest request = newRequest(false, session);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

    }

    public void testGetStoredPageProperty()
    {
        Object value = new Object();
        WebSession session = newSession("myapp,Help,bar", value);
        WebRequest request = newRequest(false, session);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

    }

    public void testGetStoredComponentProperty()
    {
        Object value = new Object();
        WebSession session = newSession("myapp,Help,zap.biff,bar", value);
        WebRequest request = newRequest(false, session);

        replayControls();

        SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.web.WebSession

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.