Examples of TilesContainer


Examples of org.apache.tiles.TilesContainer

     */
    public void doExecute(String location, ActionInvocation invocation) throws Exception {
        setLocation(location);

        ServletContext servletContext = ServletActionContext.getServletContext();
        TilesContainer container = TilesAccess.getContainer(servletContext);

        HttpServletRequest request = ServletActionContext.getRequest();
        HttpServletResponse response = ServletActionContext.getResponse();

        container.render(location, request, response);
    }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

        HttpServletResponse response = ServletActionContext.getResponse();

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

        TilesContainer container = initTilesContainer(applicationContext, servletRequest);

        container.startContext(servletRequest);
        container.render(location, servletRequest);
    }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

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

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

Examples of org.apache.tiles.TilesContainer

        if (isPreventTokenPresent(req)) {
            filterChain.doFilter(req, res);
            return;
        }
       
        TilesContainer container = TilesAccess.getContainer(getServletContext());
        mutator.mutate(container.getAttributeContext(req, res), req);
        try {
            if(preventDecorationToken != null) {
                req.setAttribute(preventDecorationToken, Boolean.TRUE);
            }
            String definitionName = getDefinitionForRequest(req);
            container.render(definitionName, req, res);
        }
        catch (TilesException e) {
            throw new ServletException("Error wrapping jsp with tile definition. "
                            + e.getMessage(), e);
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

            } else if (localeStrings.length > 2) {
                locale = new Locale(localeStrings[0], localeStrings[1], localeStrings[2]);
            }
        }
        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

Examples of org.apache.tiles.TilesContainer

     * @param event The intercepted event.
     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        try {
            TilesContainer container = createContainer(servletContext);
            TilesAccess.setContainer(servletContext, container);
        } catch (TilesException e) {
            throw new IllegalStateException("Unable to instantiate container.",
                    e);
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

    }

    /** {@inheritDoc} */
    // TODO Add a MutableContainer so that this can be done?
    public int doEndTag() throws JspException {
        TilesContainer container =
            TilesAccess.getContainer(pageContext.getServletContext());

        if (container != null) {
            LOG.warn("TilesContainer allready instantiated for this context. Ignoring request to define.");
            return SKIP_BODY;
View Full Code Here

Examples of org.apache.tiles.TilesContainer

    /** {@inheritDoc} */
    public int doStartTag() throws JspException {
        attributes = new HashMap<String, Attribute>();

        TilesContainer c =
            TilesAccess.getContainer(pageContext.getServletContext());

        if (c == null) {
            throw new JspException("TilesContainer not initialized");
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

     * @throws DefinitionsFactoryException If something goes wrong during
     * reload.
     */
    public static void reloadDefinitionsFactory(Object context)
            throws DefinitionsFactoryException {
        TilesContainer container = TilesAccess.getContainer(context);
        if (container instanceof BasicTilesContainer) {
            BasicTilesContainer basic = (BasicTilesContainer) container;
            DefinitionsFactory factory = basic.getDefinitionsFactory();
            if (factory instanceof ReloadableDefinitionsFactory) {
                ReloadableDefinitionsFactory rFactory = (ReloadableDefinitionsFactory) factory;
View Full Code Here

Examples of org.apache.tiles.TilesContainer

        url = getClass().getResource("test-defs-key-two.xml");
        EasyMock.expect(context.getResource("/WEB-INF/tiles-two.xml")).andReturn(url);
        EasyMock.replay(context);

        TilesContainerFactory factory = TilesContainerFactory.getFactory(context, 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
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.