Ok I'll describe what I'm doing:
I have an MVCApplication class which is derived from WApplication.
It contains a route matching feature that does the following:
1) Search for a matching controller.
2) if not found:
2.1) return new 404View();
3) Search for a matching action within the current controller:
4) if not found:
4.1) return new 404View();
5) Add parameters to the current action if available
So basically inside MVCApplication I have a Route class and a list of routes
that are valid for any session.
Also I have a hash map of Controllers. (As I found out they should not be
static because not all sessions share the same state/model).
Each controller registers it's actions in the constructor and each action
returns a view.
Route pattern looks like this:
[Controller]/[Parameter1]/[Action]/[Parameter2]/
Or like this:
projects/[Parameter1]/edit/
Each View is a WContainerWidget and each Controller is a WCompositeWidget.
So internalPathChanged is connected to this algorithm:
1) search for a matching route.
2) set the current view.
I provided a code example already.
2010/1/2 OvermindDL1 <[email protected]>
> On Fri, Jan 1, 2010 at 5:35 PM, omer katz <[email protected]> wrote:
> > As I thought the problem was with the static variables in MVCApplication.
> > I forgot that static variables are not thread safe.
> > Now it works but I do have a design problem.
>
> Static generally indicates a design problem in the first place. :)
> If you can give a code example or describing what you are trying to
> achieve, then we can help you come up with a better design.
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest