Package org.apache.tapestry

Examples of org.apache.tapestry.IAction


        IEngineServiceView engine,
        IRequestCycle cycle,
        ResponseOutputStream output)
        throws ServletException, IOException
    {
        IAction action = null;
        String componentPageName;
        int count = 0;

        String[] serviceContext = getServiceContext(cycle.getRequestContext());

        if (serviceContext != null)
            count = serviceContext.length;

        if (count != 4 && count != 5)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("ActionService.context-parameters"));

        boolean complex = count == 5;

        int i = 0;
        String stateful = serviceContext[i++];
        String pageName = serviceContext[i++];
        String targetActionId = serviceContext[i++];

        if (complex)
            componentPageName = serviceContext[i++];
        else
            componentPageName = pageName;

        String targetIdPath = serviceContext[i++];

        IPage page = cycle.getPage(pageName);

    // Setup the page for the rewind, then do the rewind.

    cycle.activate(page);
   
        IPage componentPage = cycle.getPage(componentPageName);
        IComponent component = componentPage.getNestedComponent(targetIdPath);

        try
        {
            action = (IAction) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(
                Tapestry.format("ActionService.component-wrong-type", component.getExtendedId()),
                component,
                null,
                ex);
        }

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

        if (stateful.equals(STATEFUL_ON) && action.getRequiresSession())
        {
            HttpSession session = cycle.getRequestContext().getSession();

            if (session == null || session.isNew())
                throw new StaleSessionException();
View Full Code Here


        IPage componentPage = componentPageName == null ? page : cycle.getPage(componentPageName);

        IComponent component = componentPage.getNestedComponent(componentId);

        IAction action = null;

        try
        {
            action = (IAction) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(EngineMessages.wrongComponentType(
                    component,
                    IAction.class), component, null, ex);
        }

        // 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),
View Full Code Here

        cycle.getPage("ActivePage");
        cyclec.setReturnValue(page);

        cycle.activate(page);

        IAction action = (IAction) newMock(IAction.class);

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        cycle.rewindPage("action-id", action);
View Full Code Here

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl actionc = newControl(IAction.class);
        IAction action = (IAction) actionc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        action.getRequiresSession();
        actionc.setReturnValue(true);

        WebSession session = newWebSession(false);
        WebRequest request = newWebRequest(session);
View Full Code Here

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl actionc = newControl(IAction.class);
        IAction action = (IAction) actionc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        action.getRequiresSession();
        actionc.setReturnValue(true);

        WebRequest request = newWebRequest(null);

        action.getExtendedId();
        actionc.setReturnValue("ActivePage/fred.barney");

        Location l = fabricateLocation(2);

        page.getLocation();
View Full Code Here

        IPage componentPage = (IPage) componentPagec.getMock();

        cycle.getPage("ComponentPage");
        cyclec.setReturnValue(componentPage);

        IAction action = (IAction) newMock(IAction.class);

        componentPage.getNestedComponent("fred.barney");
        componentPagec.setReturnValue(action);

        cycle.rewindPage("action-id", action);
View Full Code Here

        IPage componentPage = componentPageName == null ? page : cycle.getPage(componentPageName);

        IComponent component = componentPage.getNestedComponent(componentId);

        IAction action = null;

        try
        {
            action = (IAction) component;
        }
        catch (ClassCastException ex)
        {
            throw new ApplicationRuntimeException(EngineMessages.wrongComponentType(
                    component,
                    IAction.class), component, null, ex);
        }

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

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

            if (session == null || session.isNew())
                throw new StaleSessionException(EngineMessages.requestStateSession(component),
View Full Code Here

        cycle.getPage("ActivePage");
        cyclec.setReturnValue(page);

        cycle.activate(page);

        IAction action = (IAction) newMock(IAction.class);

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        cycle.rewindPage("action-id", action);
View Full Code Here

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl actionc = newControl(IAction.class);
        IAction action = (IAction) actionc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        action.getRequiresSession();
        actionc.setReturnValue(true);

        HttpSession session = newSession(false);
        HttpServletRequest request = newRequest(session);
View Full Code Here

        cyclec.setReturnValue(page);

        cycle.activate(page);

        MockControl actionc = newControl(IAction.class);
        IAction action = (IAction) actionc.getMock();

        page.getNestedComponent("fred.barney");
        pagec.setReturnValue(action);

        action.getRequiresSession();
        actionc.setReturnValue(true);

        HttpServletRequest request = newRequest(null);

        action.getExtendedId();
        actionc.setReturnValue("ActivePage/fred.barney");

        Location l = fabricateLocation(2);

        page.getLocation();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IAction

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.