tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tapestry Wiki] Update of "Tapestry5HowToControlAccess" by StefanEsterer
Date Thu, 08 May 2008 09:13:53 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.

The following page has been changed by StefanEsterer:
http://wiki.apache.org/tapestry/Tapestry5HowToControlAccess

The comment on the change is:
no need to instantiate the ComponentSource for yourself. inject it

------------------------------------------------------------------------------
    private ApplicationStateManager asm;
    private UserSessionImpl newUserSession;
    private final ComponentClassResolver resolver;
-   private final RequestPageCache cache;
+   private final ComponentSource componentSource;
  
    /**
     * Receive all the services needed as constructor arguments. When we bind this
     * service, T5 IoC will provide all the services !
     */
-   public AccessController(ApplicationStateManager asm, ComponentClassResolver resolver,
RequestPageCache cache, UserSessionImpl newUserSession)
+   public AccessController(ApplicationStateManager asm, ComponentClassResolver resolver,
ComponentSource componentSource, UserSessionImpl newUserSession)
    {
      this.asm = asm;
      this.newUserSession = newUserSession;
      this.resolver = resolver;
-     this.cache = cache;
+     this.componentSource = componentSource;
    }
  
    public boolean dispatch(Request request, Response response) throws IOException
@@ -83, +83 @@

      boolean canAccess = true;
  
      /* Is the requested page private ? */
-     ComponentSource cs = new ComponentSourceImpl(cache);
-     Component page = cs.getPage(pageName);
+     Component page = componentSource.getPage(pageName);
      Boolean privatePage = Boolean.valueOf(page.getComponentResources().getComponentModel().getMeta("private"));
          
      if (privatePage)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message