Yes I am using Jetty, but different version (8.1.1). Calling doStart() might do the trick, I'll have to try this later. But I suppose Jetty is calling the doStart() method.
On 28.08.2012 19:32, Jared Bunting wrote: > You're using Jetty? I just ran through my debugger using jetty 7.6.3 > in a similar setup (different filter, but same concept) and the init > method is called when I call server.start() on the server that is > configured with the ServletContextHandler. > > Maybe you could share more of your code with us? > > I'm using a different filter, but here's the relevant portion of my > stack trace, it may help you: > > at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:163) > at > org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102) > at > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:748) > at > org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) > at > org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:676) > at > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224) > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167) > at > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > at > org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90) > at org.eclipse.jetty.server.Server.doStart(Server.java:260) > at > org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59) > > If Filter.init() isn't getting called, perhaps another option is to > call FilterHolder.doStart(). > > Hope that helps, > Jared > > On Tue 28 Aug 2012 10:03:40 AM CDT, Gregor Jarisch wrote: >> Hi, >> >> I would like to setup my shiro config programmically. >> If have seen this example: >> http://mail-archives.apache.org/mod_mbox/shiro-user/201202.mbox/%3CCAETPiXZtvh=vg1f-yenx_egmppuqeejg7ong13jyteekhuq...@mail.gmail.com%3E >> >> Since IniShiroFilter is marked as deprecated, I switched this to >> ShiroFilter. >> >> In the example from the mailing list it says, that I have to initialize >> the filter with >> >> filter.init(filterConfig); >> >> But where do I get the filterConfig from? >> >> When I only call filter.init(); I get "IllegalArgumentException: >> ServletContext argument must not be null." >> When I just skip this init call I'll get >> "org.apache.shiro.config.ConfigurationException: Shiro INI configuration >> was either not found or discovered to be empty/unconfigured." >> >> This is my code: >> >> private static void setupShiro(ServletContextHandler context) >> { >> context.addEventListener(new EnvironmentLoaderListener()); >> >> final Ini ini = new Ini(); >> ini.addSection("main"); >> ShiroFilter shiroFilter = new ShiroFilter() >> { >> protected Ini loadIniFromConfig() >> { >> return ini; >> } >> }; >> >> context.addFilter(new FilterHolder(shiroFilter), ANY_PATH, >> getAllDispatcherTypes()); >> >> Factory<SecurityManager> factory = new >> IniSecurityManagerFactory(ini); >> SecurityManager securityManager = factory.getInstance(); >> SecurityUtils.setSecurityManager(securityManager); >> } >> >> Any ideas? >> >> Thanks >> Gregor > -- Ing. Gregor Jarisch entrepreneurship & development
