Hello Why not using a ComponentRequestFilter or even a RequestFilter ? This is perthread by default.
2009/10/1 <[email protected]> > Hello list! > > I'm using the HOWTO at the tapestry5 wiki (unaccessible right now) > for access control to my pages and implemented a dispatcher. > > I used in my AppModule > > ---------- > public static void bind(ServiceBinder binder) > { > binder.bind(OssoAccessController.class); > } > > public static void > contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration, > OssoAccessController accessController) { > configuration.add("AccessController", accessController, > "before:PageRender"); > } > ---------- > > As I'm using SSO (single sign on), the login page is external to my > application, and the login state could change without the application > knowing. The login state can be read via a request attribute. So, in my > dispatcher, I determine which user is logged on by examining the request > attribute and write the information into the session (session state > object). This means the dispatcher has to be: > > @Scope( ScopeConstants.PERTHREAD) > class OssoAccessControllerImpl {...} > > Everything seems to work well, but when I looked at the log, I was > shocked: > > ---------------------------------- > 2009-10-01 11:07:39,761 [http-8080-4] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,763 [http-8080-1] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,767 [http-8080-1] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,779 [http-8080-1] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,782 [http-8080-4] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,787 [http-8080-1] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,791 [http-8080-4] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > 2009-10-01 11:07:39,797 [http-8080-1] DEBUG > xxx.services.AppModule.OssoAccessController - Invoking constructor > xxx.services.OssoAccessControllerImpl(ApplicationStateManager, > ComponentClassResolver, ComponentSource, ConfigProperties, Logger) (at > OssoAccessControllerImpl.java:35) via > xxx.services.AppModule.bind(ServiceBinder) (at AppModule.java:31). > ---------------------------------- > > This is just for the render part request after the tapestry redirect! When > exactly is the dispatcher instantiated? I thought it would be once for > each request, not eight times. It's also strange to see two different > thread names in the log (not one, not eight). Is the dispatcher somehow > instantiated once per page and component? > > Is there something wrong with "before:PageRender"? > > Thank you, > Dirk > BGS Beratungsgesellschaft > Software Systemplanung AG Niederlassung Köln/Bonn > Grantham-Allee 2-8 > 53757 Sankt Augustin > Fon: +49 (0) 2241 / 166-500 > Fax: +49 (0) 2241 / 166-680 > www.bgs-ag.de Geschäftssitz Mainz > Registergericht > Amtsgericht Mainz > HRB 62 50 > Aufsichtsratsvorsitzender > Klaus Hellwig > Vorstand > Hermann Kiefer > Nils Manegold > Thomas Reitz > >
