Package org.apache.tiles

Examples of org.apache.tiles.TilesContainer.startContext()


        ApplicationContext applicationContext = ServletUtil.getApplicationContext(context);
        ServletRequest servletRequest = new ServletRequest(applicationContext, request, response);

        TilesContainer container = initTilesContainer(applicationContext, servletRequest);

        container.startContext(servletRequest);
        container.render(location, servletRequest);
    }

    protected TilesContainer initTilesContainer(ApplicationContext applicationContext, ServletRequest servletRequest) {
        TilesContainer container = TilesAccess.getContainer(applicationContext);
View Full Code Here


    public AttributeContext startAttributeContext() {
        Request velocityRequest = createVelocityRequest(
                getServletContext(), null);
        TilesContainer container = TilesAccess
                .getCurrentContainer(velocityRequest);
        return container.startContext(velocityRequest);
    }

    /**
     * Ends the current attribute context. To be called after
     * {@link #startAttributeContext()}.
View Full Code Here

            @Parameter(name = "name", required = true) String definitionName,
            String template, String templateType, String templateExpression,
            String role, String preparer, boolean flush, Request request, ModelBody modelBody)
            throws IOException {
        TilesContainer container = TilesAccess.getCurrentContainer(request);
        container.startContext(request);
        modelBody.evaluateWithoutWriting();
        container = TilesAccess.getCurrentContainer(request);
        renderDefinition(container, definitionName, template, templateType,
                templateExpression, role, preparer, flush, request);
    }
View Full Code Here

    public void execute(@Parameter(required = true) String template,
            String templateType, String templateExpression, String role,
            String preparer, boolean flush, Request request, ModelBody modelBody)
            throws IOException {
        TilesContainer container = TilesAccess.getCurrentContainer(request);
        container.startContext(request);
        modelBody.evaluateWithoutWriting();
        container = TilesAccess.getCurrentContainer(request);
        renderTemplate(container, template, templateType, templateExpression,
                role, preparer, flush, request);
    }
View Full Code Here

        expect(request.getAttribute(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
        expect(applicationContext.getApplicationScope()).andReturn(applicationScope).anyTimes();
        expect(servletContext.getAttribute(ApplicationAccess
                .APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(applicationContext)
                .anyTimes();
        expect(container.startContext(isA(VelocityRequest.class)))
                .andReturn(attributeContext);

        replay(velocityContext, request, response, servletContext, container,
                attributeContext, applicationContext);
        initializeTool();
View Full Code Here

        ModelBody modelBody = createMock(ModelBody.class);

        modelBody.evaluateWithoutWriting();
        expect(request.getApplicationContext()).andReturn(applicationContext).times(2);
        expect(request.getContext("request")).andReturn(requestScope).anyTimes();
        expect(container.startContext(request)).andReturn(attributeContext);
        expect(container.getAttributeContext(request)).andReturn(attributeContext);
        container.endContext(request);
        attributeContext.setPreparer("myPreparer");
        attributeContext.setTemplateAttribute((Attribute) notNull());
        container.render("myDefinitionName", request);
View Full Code Here

        expect(request.getContext("request")).andReturn(requestScope).anyTimes();
        expect(request.getWriter()).andReturn(writer);
        container.prepare("myPreparer", request);
        expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue",
                "myDefaultValueRole", "myDefaultValueType", request)).andReturn(attribute);
        expect(container.startContext(request)).andReturn(attributeContext);
        writer.write("myValue");
        container.endContext(request);

        replay(resolver, container, writer, request, applicationContext, modelBody);
        model.execute(false, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole", "myDefaultValueType",
View Full Code Here

        expect(request.getContext("request")).andReturn(requestScope).anyTimes();
        expect(request.getWriter()).andReturn(writer);
        container.prepare("myPreparer", request);
        expect(resolver.computeAttribute(container, null, "myName", "myRole", true, "myDefaultValue",
                "myDefaultValueRole", "myDefaultValueType", request)).andReturn(null);
        expect(container.startContext(request)).andReturn(attributeContext);
        container.endContext(request);

        replay(resolver, container, writer, request, applicationContext, modelBody);
        model.execute(true, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole", "myDefaultValueType",
                "myName", null, request, modelBody);
View Full Code Here

        ModelBody modelBody = createMock(ModelBody.class);

        modelBody.evaluateWithoutWriting();
        expect(request.getApplicationContext()).andReturn(applicationContext).times(2);
        expect(request.getContext("request")).andReturn(requestScope).anyTimes();
        expect(container.startContext(request)).andReturn(attributeContext);
        expect(container.getAttributeContext(request)).andReturn(attributeContext);
        container.endContext(request);
        attributeContext.setPreparer("myPreparer");
        attributeContext.setTemplateAttribute((Attribute) notNull());
        container.renderContext(request);
View Full Code Here

        expect(request.getContext("request")).andReturn(requestScope).anyTimes();

        container.prepare("myPreparer", request);
        expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue",
                "myDefaultValueRole", "myDefaultValueType", request)).andReturn(attribute);
        expect(container.startContext(request)).andReturn(attributeContext);
        container.endContext(request);
        container.render(attribute, request);

        replay(resolver, container, request, applicationContext, modelBody);
        model.execute(false, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.