Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ActionResponseGenerator


    private static final int BUFFER_SIZE = 5000;

    public ActionResponseGenerator processComponentEvent(final StreamResponse streamResponse,
            Component component, final String methodDescripion)
    {
        return new ActionResponseGenerator()
        {
            public void sendClientResponse(Response response) throws IOException
            {
                OutputStream os = null;
                InputStream is = null;
View Full Code Here


                            new RuntimeException(ex);
                        }
                    }
                };

                ActionResponseGenerator responseGenerator = _handler.handle(
                        pageName,
                        context,
                        renderer);

                if (responseGenerator != null) responseGenerator.sendClientResponse(response);

                return true;
            }

            if (atEnd) return false;
View Full Code Here

        ComponentEventHandler handler = new ComponentEventHandler()
        {
            @SuppressWarnings("unchecked")
            public boolean handleResult(Object result, Component component, String methodDescription)
            {
                ActionResponseGenerator generator = _resultProcessor.processComponentEvent(
                        result,
                        component,
                        methodDescription);

                holder.put(generator);

                return true;
            }
        };

        // If activating the page returns a "navigational result", then don't trigger the action
        // on the component.

        page.getRootElement().triggerEvent(
                TapestryConstants.ACTIVATE_EVENT,
                invocation.getActivationContext(),
                handler);

        if (holder.hasValue())
            return holder.get();

        element.triggerEvent(actionLinkTarget.getEventType(), invocation.getContext(), handler);

        ActionResponseGenerator result = holder.get();

        if (result == null)
        {
            Link link = _linkFactory.createPageLink(page);
View Full Code Here

    public void page_activation_context_in_request() throws Exception
    {
        ActionLinkHandler handler = newActionLinkHandler();
        Request request = newRequest();
        Response response = newResponse();
        ActionResponseGenerator generator = newMock(ActionResponseGenerator.class);

        train_getPath(request, "/mypage:eventname");

        train_getParameter(request, InternalConstants.PAGE_CONTEXT_NAME, "alpha/beta");

        expect(
                handler.handle(
                        eq("mypage"),
                        eq(""),
                        eq("eventname"),
                        aryEq(new String[0]),
                        aryEq(new String[]
                        { "alpha", "beta" }))).andReturn(generator);

        generator.sendClientResponse(response);

        replay();

        Dispatcher dispatcher = new ComponentActionDispatcher(handler);
View Full Code Here

            String eventType, String... context) throws IOException
    {
        ActionLinkHandler handler = newActionLinkHandler();
        Request request = newRequest();
        Response response = newResponse();
        ActionResponseGenerator generator = newMock(ActionResponseGenerator.class);

        train_getPath(request, requestPath);

        train_getParameter(request, InternalConstants.PAGE_CONTEXT_NAME, null);

        expect(
                handler.handle(
                        eq(logicalPageName),
                        eq(nestedComponentId),
                        eq(eventType),
                        aryEq(context),
                        aryEq(new String[0]))).andReturn(generator);

        generator.sendClientResponse(response);

        replay();

        Dispatcher dispatcher = new ComponentActionDispatcher(handler);
View Full Code Here

     *            The ComponentInvocation object corresponding to the action link.
     * @return The DOM created. Typically you will assert against it.
     */
    public Document invoke(ComponentInvocation invocation)
    {
        ActionResponseGenerator generator = click(invocation);

        if (generator instanceof LinkActionResponseGenerator)
        {
            LinkActionResponseGenerator linkGenerator = (LinkActionResponseGenerator) generator;

            Link link = linkGenerator.getLink();

            ComponentInvocation followup = _componentInvocationMap.get(link);

            return _followupInvoker.invoke(followup);
        }

        String message = String
                .format(
                        "ActionResponseGenerator %s is an instance of class %s, which is not compatible with PageTester.",
                        generator,
                        generator.getClass());

        throw new RuntimeException(message);
    }
View Full Code Here

    private static final int BUFFER_SIZE = 5000;

    public ActionResponseGenerator processComponentEvent(final StreamResponse streamResponse,
            Component component, final String methodDescripion)
    {
        return new ActionResponseGenerator()
        {
            public void sendClientResponse(Response response) throws IOException
            {
                OutputStream os = null;
                InputStream is = null;
View Full Code Here

        ComponentEventHandler handler = new ComponentEventHandler()
        {
            @SuppressWarnings("unchecked")
            public boolean handleResult(Object result, Component component, String methodDescription)
            {
                ActionResponseGenerator generator = _resultProcessor.processComponentEvent(
                        result,
                        component,
                        methodDescription);

                holder.put(generator);
View Full Code Here

        ComponentEventHandler handler = new ComponentEventHandler()
        {
            @SuppressWarnings("unchecked")
            public boolean handleResult(Object result, Component component, String methodDescription)
            {
                ActionResponseGenerator generator = _resultProcessor.processComponentEvent(
                        result,
                        component,
                        methodDescription);

                holder.put(generator);

                return true;
            }
        };

        // If activating the page returns a "navigational result", then don't trigger the action
        // on the component.

        page.getRootElement().triggerEvent(
                TapestryConstants.ACTIVATE_EVENT,
                activationContext,
                handler);

        if (holder.hasValue()) return holder.get();

        element.triggerEvent(eventType, context, handler);

        ActionResponseGenerator result = holder.get();

        if (result == null)
        {
            Link link = _linkFactory.createPageLink(page, false);
View Full Code Here

            if (_componentClassResolver.isPageName(pageName))
            {
                String[] context = atEnd ? new String[0] : convertActivationContext(path
                        .substring(nextslashx + 1));

                ActionResponseGenerator responseGenerator = _handler.handle(pageName, context);

                if (responseGenerator != null) responseGenerator.sendClientResponse(response);

                return true;
            }

            if (atEnd) return false;
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.ActionResponseGenerator

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.