Package org.apache.tiles

Examples of org.apache.tiles.TilesContainer


     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        String key = servletContext.getInitParameter(
                CONTAINER_KEY_INIT_PARAMETER);
        TilesContainer container = createContainer(servletContext);
        TilesAccess.setContainer(servletContext, container, key);
    }
View Full Code Here


     * @param key The key under which the container is stored.
     * @since 2.1.0
     */
    public static void setCurrentContainer(ServletRequest request,
            ServletContext context, String key) {
        TilesContainer container = TilesAccess.getContainer(context, key);
        if (container != null) {
            request.setAttribute(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
        } else {
            throw new NoSuchContainerException("The container with the key '"
                    + key + "' cannot be found");
View Full Code Here

     * @return The current Tiles container to use in web pages.
     * @since 2.1.0
     */
    public static TilesContainer getCurrentContainer(ServletRequest request,
            ServletContext context) {
        TilesContainer container = (TilesContainer) request
                .getAttribute(CURRENT_CONTAINER_ATTRIBUTE_NAME);
        if (container == null) {
            container = TilesAccess.getContainer(context);
            request.setAttribute(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
        }
View Full Code Here

        if (isPreventTokenPresent(req)) {
            filterChain.doFilter(req, res);
            return;
        }

        TilesContainer container = TilesAccess.getContainer(
                getServletContext(), containerKey);
        mutator.mutate(container.getAttributeContext(req, res), req);
        if (preventDecorationToken != null) {
            req.setAttribute(preventDecorationToken, Boolean.TRUE);
        }
        String definitionName = getDefinitionForRequest(req);
        container.render(definitionName, req, res);
    }
View Full Code Here

     * @throws org.apache.tiles.definition.DefinitionsFactoryException If
     * something goes wrong during reload.
     */
    public static void reloadDefinitionsFactory(Object context,
            String containerKey) {
        TilesContainer container = TilesAccess.getContainer(context,
                containerKey);
        if (container instanceof BasicTilesContainer) {
            BasicTilesContainer basic = (BasicTilesContainer) container;
            DefinitionsFactory factory = basic.getDefinitionsFactory();
            if (factory instanceof Refreshable) {
View Full Code Here

        rendererFactory = new BasicRendererFactory();
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        rendererFactory.setApplicationContext(applicationContext);
        rendererFactory.setContextFactory(contextFactory);
        rendererFactory.setContainer(container);
        EasyMock.replay(applicationContext, contextFactory, container);
    }
View Full Code Here

        EasyMock.replay(context);

        TilesContainerFactory factory = (TilesContainerFactory) AbstractTilesContainerFactory
                .getTilesContainerFactory(context);
        factory.setDefaultConfiguration(defaults);
        TilesContainer container = factory.createContainer(context);

        assertNotNull(container);
        assertTrue("The container is not an instance of KeyedDefinitionsFactoryTilesContainer",
                container instanceof KeyedDefinitionsFactoryTilesContainer);
        KeyedDefinitionsFactoryTilesContainer keyedContainer =
            (KeyedDefinitionsFactoryTilesContainer) container;
        assertNotNull(keyedContainer.getDefinitionsFactory());
        assertNotNull(keyedContainer.getDefinitionsFactory("one"));
        assertNotNull(keyedContainer.getDefinitionsFactory("two"));
        //now make sure it's initialized
        try {
            container.init(new HashMap<String, String>());
            fail("Container should have already been initialized");
        } catch (IllegalStateException te) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("The container has been initialized, the exception is ok", te);
            }
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createContainer(Object)}.
     */
    public void testCreateContainer() {
        TilesContainer container = factory.createContainer(context);
        assertTrue("The class of the container is not correct",
                container instanceof BasicTilesContainer);
    }
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createRendererFactory(Object,
     * TilesApplicationContext, TilesContextFactory, TilesContainer, AttributeEvaluator)}.
     */
    public void testCreateRendererFactory() {
        TilesContainer container = factory.createContainer(context);
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createDefaultAttributeRenderer(Object,
     * TilesApplicationContext, TilesContextFactory, TilesContainer, AttributeEvaluator)}.
     */
    public void testCreateDefaultAttributeRenderer() {
        TilesContainer container = factory.createContainer(context);
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
View Full Code Here

TOP

Related Classes of org.apache.tiles.TilesContainer

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.