Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ActionResponseGenerator


    public void page_activation_context_in_request() throws Exception
    {
        ActionLinkHandler handler = newActionLinkHandler();
        Request request = mockRequest();
        Response response = mockResponse();
        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 = mockRequest();
        Response response = mockResponse();
        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

    public void page_activation_context_in_request() throws Exception
    {
        ComponentActionRequestHandler handler = newComponentActionRequestHandler();
        Request request = mockRequest();
        Response response = mockResponse();
        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
    {
        ComponentActionRequestHandler handler = newComponentActionRequestHandler();
        Request request = mockRequest();
        Response response = mockResponse();
        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

                            new RuntimeException(ex);
                        }
                    }
                };

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

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

                return true;
            }

            if (atEnd)
View Full Code Here

        String activationContextValue = request.getParameter(InternalConstants.PAGE_CONTEXT_NAME);

        String[] activationContext = activationContextValue == null ? _emptyString
                : decodeContext(activationContextValue);

        ActionResponseGenerator responseGenerator = _actionLinkHandler.handle(
                logicalPageName,
                nestedComponentId,
                eventType,
                eventContext,
                activationContext);

        responseGenerator.sendClientResponse(response);

        return true;
    }
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

        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

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.