Seems like if you want to do anything in a listener that requires shiro (such as starting a thread that is associated with a subject as I currently suggested in another thread), you would need Shiro already initialized. Maybe we just need a ShiroServletContextListener? This could fit in well with the notion of storing the SecurityManager in the WebApp Context.
On 05/09/2011 05:29 PM, dan wrote: > Consider the following webapp startup process: > > 1. web.xml specifies a <listener> and primary app initialization happens in > its contextInitialized() method. > > 2. The app initialization triggers some background process, which starts > with getSubject() ... > > 3. web.xml specifies a <filter> and the IniShiroFilter filter is invoked to > initialize shiro > > The issue is that the background process which calls getSubject() will fail > because Shiro hasn't been initialized. It appears that what I would like to > implement is a two-stage initialization: > 1. initialize the basic Shiro environment with our classpath shiro.ini > in the <listener> method. > 2. initialize the web-specific part of Shiro in IniShiroFilter. > It didn't seem like this two stage initialization is currently possible. > Any ideas on this corner case? > > (Note: App initialization early on with the listener is recommended, for one > reason because it allows for graceful aborting from startup.) > > Thanks, > Dan > > -- > View this message in context: > http://shiro-user.582556.n2.nabble.com/Webapp-initialization-happens-before-Shiro-initialization-tp6345903p6345903.html > Sent from the Shiro User mailing list archive at Nabble.com.
