Package org.apache.tiles.servlet.context

Examples of org.apache.tiles.servlet.context.ServletTilesApplicationContext


    /** {@inheritDoc} */
    @Override
    public void init() throws ServletException {
        ServletContext adaptedContext = new ServletContextAdapter(
                getServletConfig());
        ServletTilesApplicationContext preliminaryContext = new ServletTilesApplicationContext(
                adaptedContext);
        initializer.initialize(preliminaryContext);
    }
View Full Code Here


        for (Map.Entry<String, String> entry : initParameters.entrySet()) {
            context.setInitParameter(entry.getKey(), entry.getValue());
        }

        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesApplicationContextFactory acFactory = AbstractTilesApplicationContextFactory
                .createFactory(applicationContext);
        applicationContext = acFactory.createApplicationContext(context);
View Full Code Here

    if (!(container instanceof BasicTilesContainer)) {
      // Cannot check properly - let's assume it's there.
      return true;
    }
    BasicTilesContainer basicContainer = (BasicTilesContainer) container;
    TilesApplicationContext appContext = new ServletTilesApplicationContext(getServletContext());
    TilesRequestContext requestContext = new ServletTilesRequestContext(appContext, null, null) {
      @Override
      public Locale getRequestLocale() {
        return locale;
      }
View Full Code Here

    if (!(container instanceof BasicTilesContainer)) {
      // Cannot check properly - let's assume it's there.
      return true;
    }
    BasicTilesContainer basicContainer = (BasicTilesContainer) container;
    TilesApplicationContext appContext = new ServletTilesApplicationContext(getServletContext());
    TilesRequestContext requestContext = new ServletTilesRequestContext(appContext, null, null) {
      @Override
      public Locale getRequestLocale() {
        return locale;
      }
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test
    public void testRegisterAttributeRenderers() {
        BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
        ServletTilesApplicationContext applicationContext = createMock(ServletTilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        ServletContext servletContext = createMock(ServletContext.class);

        rendererFactory.registerRenderer(eq("string"),
                isA(StringAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("template"),
                isA(TemplateAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("definition"),
                isA(DefinitionAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("freemarker"),
                isA(FreeMarkerAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("velocity"),
                isA(VelocityAttributeRenderer.class));

        expect(applicationContext.getContext()).andReturn(servletContext)
                .anyTimes();
        expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY))
                .andReturn(null);
        expect(servletContext.getInitParameter(VelocityView.TOOLS_KEY))
                .andReturn(null);
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test
    public void testRegisterAttributeRenderers() {
        BasicRendererFactory rendererFactory = createMock(BasicRendererFactory.class);
        ServletTilesApplicationContext applicationContext = createMock(ServletTilesApplicationContext.class);
        TilesRequestContextFactory contextFactory = createMock(TilesRequestContextFactory.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeEvaluatorFactory attributeEvaluatorFactory = createMock(AttributeEvaluatorFactory.class);
        ServletContext servletContext = createMock(ServletContext.class);

        rendererFactory.registerRenderer(eq("string"),
                isA(StringAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("template"),
                isA(TemplateAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("definition"),
                isA(DefinitionAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("freemarker"),
                isA(FreeMarkerAttributeRenderer.class));
        rendererFactory.registerRenderer(eq("velocity"),
                isA(VelocityAttributeRenderer.class));

        expect(applicationContext.getContext()).andReturn(servletContext)
                .anyTimes();
        expect(servletContext.getInitParameter(VelocityView.PROPERTIES_KEY))
                .andReturn(null);
        expect(servletContext.getInitParameter(VelocityView.TOOLS_KEY))
                .andReturn(null);
View Full Code Here

     * @param context The servlet context to use.
     * @return The created container.
     * @deprecated Extend {@link BasicTilesInitializer}.
     */
    protected TilesContainer createContainer(ServletContext context) {
        TilesApplicationContext applicationContext = new ServletTilesApplicationContext(
                context);
        AbstractTilesContainerFactory factory = AbstractTilesContainerFactory
                .getTilesContainerFactory(applicationContext);
        return factory.createContainer(applicationContext);
    }
View Full Code Here

    @Override
    public void init() throws ServletException {
        initializer = createTilesInitializer();
        ServletContext adaptedContext = new ServletContextAdapter(
                getServletConfig());
        ServletTilesApplicationContext preliminaryContext = new ServletTilesApplicationContext(
                adaptedContext);
        initializer.initialize(preliminaryContext);
    }
View Full Code Here

     * @param event The intercepted event.
     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        initializer = createTilesInitializer();
        initializer.initialize(new ServletTilesApplicationContext(
                servletContext));
    }
View Full Code Here

        if (!(container instanceof BasicTilesContainer)) {
            // Cannot check properly - let's assume it's there.
            return true;
        }
        BasicTilesContainer basicContainer = (BasicTilesContainer) container;
        TilesApplicationContext appContext = new ServletTilesApplicationContext(getServletContext());
        TilesRequestContext requestContext = new ServletTilesRequestContext(appContext, null, null) {
            @Override
            public Locale getRequestLocale() {
                return locale;
            }
View Full Code Here

TOP

Related Classes of org.apache.tiles.servlet.context.ServletTilesApplicationContext

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.