You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2008/05/08 11:13:53 UTC

[Tapestry Wiki] Update of "Tapestry5HowToControlAccess" by StefanEsterer

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