Package org.apache.tapestry

Examples of org.apache.tapestry.IAction


        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


        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

    public void testServiceSimple() throws Exception
    {
        IRequestCycle cycle = newCycle();
        IPage page = newPage();
        IAction action = newAction();
        ResponseRenderer rr = newResponseRenderer();

        trainGetParameter(cycle, ServiceConstants.COMPONENT, "fred.barney");
        trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
        trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
View Full Code Here

    public void testSeviceActiveSession() throws Exception
    {
        IRequestCycle cycle = newCycle();
        IPage page = newPage();
        IAction action = newAction();
        WebSession session = newWebSession(false);
        WebRequest request = newWebRequest(session);
        ResponseRenderer rr = newResponseRenderer();

        trainGetParameter(cycle, ServiceConstants.COMPONENT, "fred.barney");
View Full Code Here

    public void testServiceStaleSession() throws Exception
    {
        IRequestCycle cycle = newCycle();
        IPage page = newPage();
        IAction action = newAction();
        WebRequest request = newWebRequest(null);
        Location l = newLocation();

        trainGetParameter(cycle, ServiceConstants.COMPONENT, "fred.barney");
        trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
View Full Code Here

    public void testServiceComplex() throws Exception
    {
        IRequestCycle cycle = newCycle();
        IPage activePage = newPage();
        IPage componentPage = newPage();
        IAction action = newAction();
        ResponseRenderer rr = newResponseRenderer();

        trainGetParameter(cycle, ServiceConstants.COMPONENT, "fred.barney");
        trainGetParameter(cycle, ServiceConstants.CONTAINER, "ComponentPage");
        trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
View Full Code Here

        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

        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

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.