Package org.apache.tapestry

Examples of org.apache.tapestry.IRequestCycle


    private IRequestCycle newCycle(String pageName)
    {
        IPage page = newPage();

        MockControl control = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) control.getMock();

        cycle.getPage(pageName);
        control.setReturnValue(page);

        return cycle;
    }
View Full Code Here


        return result;
    }

    public void testNoMatchOnContentType()
    {
        IRequestCycle cycle = newCycle();

        MockControl requestc = newControl(PortletRequest.class);
        PortletRequest request = (PortletRequest) requestc.getMock();

        trainContentType(requestc, request, "text/xml");
View Full Code Here

        verifyControls();
    }

    public void testNoMatchOnPortletMode()
    {
        IRequestCycle cycle = newCycle();

        MockControl requestc = newControl(PortletRequest.class);
        PortletRequest request = (PortletRequest) requestc.getMock();

        trainPortletMode(requestc, request, "edit");
View Full Code Here

        verifyControls();
    }

    public void testNoMatchOnWindowState()
    {
        IRequestCycle cycle = newCycle();

        MockControl requestc = newControl(PortletRequest.class);
        PortletRequest request = (PortletRequest) requestc.getMock();

        trainWindowState(requestc, request, "huge");
View Full Code Here

        verifyControls();
    }

    public void testSortingCounts()
    {
        IRequestCycle cycle = newCycle("EditHuge");

        MockControl requestc = newControl(PortletRequest.class);
        PortletRequest request = (PortletRequest) requestc.getMock();

        List l = new ArrayList();
View Full Code Here

    public void testPageMissing()
    {
        IPage page = newPage();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        MockControl requestc = newControl(PortletRequest.class);
        PortletRequest request = (PortletRequest) requestc.getMock();

        List l = new ArrayList();
        l.add(newContribution(null, "edit", null, "EditNormal"));
        l.add(newContribution(null, "edit", "huge", "EditHuge"));

        trainPortletMode(requestc, request, "edit");
        trainWindowState(requestc, request, "huge");

        cycle.getPage("EditHuge");
        cyclec.setThrowable(new PageNotFoundException("missing!"));

        trainPortletMode(requestc, request, "edit");

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

        replayControls();

        MatchingPortletPageResolver resolver = new MatchingPortletPageResolver();
View Full Code Here

     * Delegate method for the servlet. Services the request.
     */

    public void service(WebRequest request, WebResponse response) throws IOException
    {
        IRequestCycle cycle = null;
        IMonitor monitor = null;
        IEngineService service = null;

        if (_infrastructure == null)
            _infrastructure = (Infrastructure) request.getAttribute(Constants.INFRASTRUCTURE_KEY);

        try
        {
            try
            {
                cycle = _infrastructure.getRequestCycleFactory().newRequestCycle(this);

                monitor = cycle.getMonitor();
                service = cycle.getService();

                monitor.serviceBegin(service.getName(), _infrastructure.getRequest()
                        .getRequestURI());

                // Let the service handle the rest of the request.

                service.service(cycle);

                return;
            }
            catch (PageRedirectException ex)
            {
                handlePageRedirectException(cycle, ex);
            }
            catch (RedirectException ex)
            {
                handleRedirectException(cycle, ex);
            }
            catch (StaleLinkException ex)
            {
                handleStaleLinkException(cycle, ex);
            }
            catch (StaleSessionException ex)
            {
                handleStaleSessionException(cycle, ex);
            }
        }
        catch (Exception ex)
        {
            monitor.serviceException(ex);

            // Attempt to switch to the exception page. However, this may itself
            // fail for a number of reasons, in which case an ApplicationRuntimeException is
            // thrown.

            if (LOG.isDebugEnabled())
                LOG.debug("Uncaught exception", ex);

            activateExceptionPage(cycle, ex);
        }
        finally
        {
            if (service != null)
                monitor.serviceEnd(service.getName());

            try
            {
                cycle.cleanup();
                _infrastructure.getApplicationStateManager().flush();
            }
            catch (Exception ex)
            {
                reportException(EngineMessages.exceptionDuringCleanup(ex), ex);
View Full Code Here

        IPropertySelectionModel model = buildBooksModel();

        if (model.getOptionCount() == 0)
        {
            IRequestCycle cycle = getRequestCycle();
            IActivate page = (IActivate) cycle.getPage("MyLibrary");

            page.activate(cycle);

            throw new PageRedirectException(page);
        }
View Full Code Here

    }

    private IRequestCycle newCycle(String pageName, IPage page)
    {
        MockControl control = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) control.getMock();

        cycle.activate(pageName);

        cycle.getPage();
        control.setReturnValue(page);

        cycle.getAttribute("org.apache.tapestry.PageRenderSupport");
        control.setReturnValue(null);

        // We can check that an instance of PageRenderSupport is passed in, but
        // we can't (easily) check thta it's configured the way we want.
        cycle.setAttribute("org.apache.tapestry.PageRenderSupport", new PageRenderSupportImpl(
                newAssetService(), "", null));
        control.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { null, new TypeMatcher() }));

        return cycle;
View Full Code Here

        MarkupWriterSource source = newSource(pw, ct, writer);
        IPage page = newPage(ct);
        IEngineService assetService = newAssetService();

        IRequestCycle cycle = newCycle("ZePage", page);

        cycle.renderPage(nested);

        writer.comment("BEGIN Tapestry Portlet appId NAMESPACE");
        writer.comment("Page: ZePage");

        writer.comment("Generated:.*");
 
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IRequestCycle

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.