Uploaded image for project: 'Tiles'
  1. Tiles
  2. TILES-387

Creating a tilesConfigurer for Spring Web does not work in an OSGi environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.1.2
    • None
    • tiles-api, tiles-servlet
    • None
    • Any

    Description

      As of Tiles 2.1.1, the TilesConfigurer that was written by the Spring guys no longer works as they are using deprecated attributes in Tiles. They are working on a new tiles configurer for v3 of Spring. In the meantime, there have been some solutions submitted by the community. They work in a regular environment but not within an OSGi environment.

      (see here for details on the issue raised: http://jira.springframework.org/browse/SPR-5411)

      The problem is this:
      public SpringTilesConfigurer()

      { this.tilesPropertyMap.put( AbstractTilesApplicationContextFactory.APPLICATION_CONTEXT_FACTORY_INIT_PARAM, WildcardServletTilesApplicationContextFactory.class.getName()); this.tilesPropertyMap.put( TilesContainerFactory.PREPARER_FACTORY_INIT_PARAM, BasicPreparerFactory.class.getName()); this.tilesPropertyMap.put( DefinitionsFactory.LOCALE_RESOLVER_IMPL_PROPERTY, SpringLocaleResolver.class.getName()); this.tilesPropertyMap.put(TilesContainerFactory.ATTRIBUTE_EVALUATOR_INIT_PARAM, ELAttributeEvaluator.class.getName()); this.tilesPropertyMap.put(TilesContainerFactory.CONTAINER_FACTORY_MUTABLE_INIT_PARAM, Boolean.toString(false)); }

      protected TilesContainer createTilesContainer() throws TilesException

      { ServletContextAdapter adaptedContext = new ServletContextAdapter(new DelegatingServletConfig()); TilesApplicationContext preliminaryContext = new ServletTilesApplicationContext(adaptedContext); AbstractTilesApplicationContextFactory contextFactory = AbstractTilesApplicationContextFactory.createFactory(preliminaryContext); this.tilesContext = contextFactory.createApplicationContext(adaptedContext); AbstractTilesContainerFactory factory = AbstractTilesContainerFactory.getTilesContainerFactory(this.tilesContext); return factory.createContainer(this.tilesContext); }

      When trying to create the context factory, it will try to initialize WildcardServletTilesApplicationContextFactory in AbstractTilesApplicationContextFactory:80 with the help of ClassUtil. Now WildcardServletTilesApplicationContextFactory is located in the tiles-servlet bundle while ClassUtil is located in tiles-api. Tiles-api does not have an import dependency on tiles-servlet (as it should be) so when ClassUtil tries to instantiate the class it cannot find it. This problem also occurs when trying to instantiate the TilesContainerFactory.

      Is there something the Tiles team needs to do in order to make this a work within OSGi or is the Spring community going at it the wrong way?

      Cheers
      bjorn

      Attachments

        Activity

          People

            Unassigned Unassigned
            bjornharvold Bjorn Harvold
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: