Examples of TilesContainer


Examples of org.apache.tiles.TilesContainer

  }

  protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    TilesContainer container = TilesAccess.getContainer(getServletContext());
    if (container == null) {
      throw new ServletException("Tiles container is not initialized. " +
          "Have you added a TilesConfigurer to your web application context?");
    }

    exposeModelAsRequestAttributes(model, request);
    JstlUtils.exposeLocalizationContext(request, this.jstlAwareMessageSource);

    if (!response.isCommitted()) {
      // Tiles is going to use a forward, but some web containers (e.g. OC4J 10.1.3)
      // do not properly expose the Servlet 2.4 forward request attributes...
      WebUtils.exposeForwardRequestAttributes(request);
    }

    container.render(getUrl(), new Object[] {request, response});
  }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

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

Examples of org.apache.tiles.TilesContainer

    /**
     * TODO Add a MutableContainer so that this can be done?
     * Do start tag.
     */
    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

     * @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

    }

    public int doStartTag() throws JspException {
        attributes = new HashMap<String, ComponentAttribute>();

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

        if(!(c instanceof MutableTilesContainer)) {
            throw new JspException("Unable to define definition for a " +
                "container which does not implement MutableTilesContainer");
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) {
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

        EasyMock.expect(context.getInitParameterNames()).andReturn(enumeration.elements()).anyTimes();
        EasyMock.expect(context.getResource("/WEB-INF/tiles.xml")).andReturn(url);
        EasyMock.replay(context);

        TilesContainerFactory factory = TilesContainerFactory.getFactory(context);
        TilesContainer container = factory.createContainer(context);

        assertNotNull(container);
        //now make sure it's initialized
        try {
            container.init(new HashMap<String, String>());
            fail("Container should have already been initialized");
        }
        catch (IllegalStateException te) {
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

     */
    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain)
        throws IOException, ServletException {

        TilesContainer container = TilesAccess.getContainer(servletContext);
        ComponentContext ctx = container.getComponentContext(request, response);

        ComponentAttribute attr = new ComponentAttribute();
        attr.setType(ComponentAttribute.TEMPLATE);
        attr.setName(targetAttributeName);
        attr.setValue(getTargetResource(request));
        ctx.putAttribute(targetAttributeName, attr);

        try {
            container.render(request, response, definition);
        } catch (TilesException e) {
            throw new ServletException("Error wrapping jsp with tile definition.", e);
        }
    }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

         throws Exception {
      String beanName = getBeanName();
      String url = getUrl();

        ServletContext servletContext = getServletContext();
        TilesContainer container = TilesAccess.getContainer(servletContext);
        if (container == null) {
            throw new ServletException("Tiles container is not initialized. " +
                                       "Have you added a TilesConfigurer to your web application context?");
        }
View Full Code Here

Examples of org.apache.tiles.TilesContainer

  protected void renderMergedOutputModel(Map model,
                                         HttpServletRequest request, HttpServletResponse response)
         throws Exception {

        ServletContext servletContext = getServletContext();
        TilesContainer container = TilesAccess.getContainer(servletContext);
        if (container == null) {
            throw new ServletException("Tiles container is not initialized. " +
                                       "Have you added a TilesConfigurer to your web application context?");
        }
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.