2009年7月27日星期一

Re: [fw-mvc] router vs pre-dispatch

On Mon, Jul 27, 2009 at 3:38 PM, Seth Atkins <satkins@nortel.com> wrote:
 
I'm curious about when I should use routing or pre-dispatch for altering a request. Both can in effect accomplish re-routing, and I'm not real familiar with the pros and cons of either. In pre-dispatch, I can create a custom plugin that looks at the request and then changes the request object module/controller/action as a result.

The router maps the request to the module, controller, action and sets defaults before the controller is instantiated and pre-dispatch called.  It's job isn't to modify the request, rather it's job is to gather the parameters from the request and route.

The reason you see ACLs in the pre-dispatch is that the request matches a controller, but there is something missing, like an authenticated session.  If the request is repeated with an authenticated session, it's not redirected to login.

- pw

没有评论: