Package org.apache.tiles

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


        }
        session.setAttribute(DefaultLocaleResolver.LOCALE_KEY, locale);
        TilesContainer container = TilesAccess.getContainer(request
                .getSession().getServletContext());
        try {
            container.render("test.localized.definition", request, response);
        } catch (TilesException e) {
            throw new ServletException("Cannot render 'test.localized.definition' definition", e);
        }
    }
}
View Full Code Here


        }
        AttributeContext attributeContext = container.startContext(request, response);
        Attribute attr = new Attribute(actionUrl);
        attributeContext.putAttribute("body", attr);
        try {
            container.render("main.layout", request, response);
            container.endContext(request, response);
        } catch (Exception e) {
            if (log.isDebugEnabled()) {  // Intentionally logged at debug level
                log.debug("Error occurred while rendering." +
                          " We generally see this 'harmless' exception on WebLogic. Hiding it.", e);
View Full Code Here

        expect(applicationScope.get("key")).andReturn(container);
        expect(container.getAttributeContext(isA(ServletRequest.class))).andReturn(attributeContext);
        request.setAttribute("org.apache.tiles.decoration.PREVENT:tokenKey", true);
        expect(request.getAttribute("javax.servlet.include.servlet_path")).andReturn(null);
        expect(request.getServletPath()).andReturn("/tiles");
        container.render(eq("definitionKey"), isA(ServletRequest.class));
        chain.doFilter(request, response);

        replay(servletContext, request, response, chain, applicationContext,
                applicationScope, container, attributeContext);
        filter.doFilter(request, response, chain);
View Full Code Here

        try {
            String definition = getDefinitionName(req);
            if (LOG.isDebugEnabled()) {
                LOG.info("Dispatching to tile '" + definition + "'");
            }
            container.render(req, res, definition);
        } catch (TilesException e) {
            throw new ServletException("Error rendering tile.", e);
        }
    }
View Full Code Here

        throws IOException, ServletException {
        TilesContainer container = TilesAccess.getContainer(getServletContext());
        mutator.mutate(container.getComponentContext(req, res), req);
        try {
            String definitionName = getDefinitionForRequest(req);
            container.render(req, res, definitionName);
        } catch (TilesException e) {
            throw new ServletException("Error wrapping jsp with tile definition. "+e.getMessage(), e);
        }
    }
View Full Code Here

                null, getResponse(), getRequest()) {

            public boolean render(InternalContextAdapter context, Writer writer)
                    throws IOException {
                TilesContainer container = ServletUtil.getCurrentContainer(request, getServletContext());
                container.render(attribute, velocityContext, request, response, writer);
                return true;
            }

        };
    }
View Full Code Here

        return new AbstractDefaultToStringRenderable(getVelocityContext(),
                null, getResponse(), getRequest()) {

            public boolean render(InternalContextAdapter context, Writer writer) {
                TilesContainer container = ServletUtil.getCurrentContainer(request, getServletContext());
                container.render(definitionName, velocityContext, request, response, writer);
                return true;
            }

        };
    }
View Full Code Here

        StringWriter writer = new StringWriter();
        Attribute attribute = new Attribute("myValue");

        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME))
                .andReturn(container);
        container.render(attribute, velocityContext, request, response, writer);

        replay(velocityContext, request, response, servletContext, container, internalContextAdapter);
        initializeTool();
        Renderable renderable = tool.render(attribute);
        renderable.render(internalContextAdapter, writer);
View Full Code Here

        InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class);
        StringWriter writer = new StringWriter();

        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME))
                .andReturn(container);
        container.render("myDefinition", velocityContext, request, response, writer);

        replay(velocityContext, request, response, servletContext, container, internalContextAdapter);
        initializeTool();
        Renderable renderable = tool.renderDefinition("myDefinition");
        renderable.render(internalContextAdapter, writer);
View Full Code Here

        mutator.mutate(container.getAttributeContext(req, res), req);
        if (preventDecorationToken != null) {
            req.setAttribute(preventDecorationToken, Boolean.TRUE);
        }
        String definitionName = getDefinitionForRequest(req);
        container.render(definitionName, req, res);
    }

    /**
     * Returns the final definition to render for the given request.
     *
 
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.