You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Nicolas Le Bas (JIRA)" <ji...@apache.org> on 2012/05/22 20:45:43 UTC

[jira] [Created] (TILES-551) ModularTilesInitializer attempts to create and register multiple ApplicationContexts in the webapp

Nicolas Le Bas created TILES-551:
------------------------------------

             Summary: ModularTilesInitializer attempts to create and register multiple ApplicationContexts in the webapp
                 Key: TILES-551
                 URL: https://issues.apache.org/jira/browse/TILES-551
             Project: Tiles
          Issue Type: Bug
            Reporter: Nicolas Le Bas
            Priority: Minor


When using ModularTilesInitializer, an ApplicationContext can be created by each TilesInitializer, which will then be registered into the ServletContext by the TilesContainer.

As a result, the registered ApplicationContext may vary depending on the classpath order, leading to unreliable results.

Indeed we should use a single ApplicationContext in an application; in any case, registering the ApplicationContext with the ServletContext should not be the responsibility of the TilesContainer.

As a workaround, use a singleton pattern to create the ApplicationContext in each TilesInitializer.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TILES-551) ModularTilesInitializer attempts to create and register multiple ApplicationContexts in the webapp

Posted by "Nicolas Le Bas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TILES-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13449800#comment-13449800 ] 

Nicolas Le Bas commented on TILES-551:
--------------------------------------

I feel this feature could just be dropped in favor of OSGi support. 

TilesInitializer is very similar to BundleActivator, and we should be able to build an ApplicationContext from BundleContext easily enough:

getInitParams() -> getBundle().getHeaders()
getResource() -> getBundle().getEntry()
getResources() -> getBundle().findEntries()
getApplicationScope() -> a read-only map of OSGi services defined in the bundle's MANIFEST.MF
                
> ModularTilesInitializer attempts to create and register multiple ApplicationContexts in the webapp
> --------------------------------------------------------------------------------------------------
>
>                 Key: TILES-551
>                 URL: https://issues.apache.org/jira/browse/TILES-551
>             Project: Tiles
>          Issue Type: Bug
>            Reporter: Nicolas Le Bas
>            Priority: Minor
>
> When using ModularTilesInitializer, an ApplicationContext can be created by each TilesInitializer, which will then be registered into the ServletContext by the TilesContainer.
> As a result, the registered ApplicationContext may vary depending on the classpath order, leading to unreliable results.
> Indeed we should use a single ApplicationContext in an application; in any case, registering the ApplicationContext with the ServletContext should not be the responsibility of the TilesContainer.
> As a workaround, use a singleton pattern to create the ApplicationContext in each TilesInitializer.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira