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

                 Key: TILES-387
                 URL: https://issues.apache.org/struts/browse/TILES-387
             Project: Tiles
          Issue Type: Bug
          Components: tiles-api, tiles-servlet
    Affects Versions: 2.1.2
         Environment: Any
            Reporter: Bjorn Harvold


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to