abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Diephouse <dan.diepho...@mulesource.com>
Subject Re: RouteManager
Date Tue, 29 Jan 2008 17:05:26 GMT
James M Snell wrote:
> FYI.. within the i18n and server modules, you will find two new 
> classes: Route and RouteManager.  A "Route" is loosely based on the 
> Ruby on Rails route concept for URI templating, e.g. 
> ":collection/:entry". RouteManager is a Target Resolver and Target 
> Builder implementation that uses simple routes.
> For instance,
>   RouteManager rm = new RouteManager()
>     .addRoute("feed", ":collection", TargetType.TYPE_COLLECTION)
>     .addRoute("entry", ":collection/:entry:", TargetType.TYPE_SERVICE);
> A Provider can then use RouteManager as the Target Resolver and Target 
> Builder.
> Then mechanism is highly experimental and definitely needs more 
> fleshing out but the foundation is there.
> Comments/Feedback/Suggestions are requested.
> - James
I'm actually diving into this right now. Awesome stuff. I like this 
approach way better than our current approach. It allows easy 
modification of route rules, allows us to get rid of StructuredResolver, 
and also allows us to to build a workspaceManager that works for most 
cases by default! All big issues I'm having at the moment :-) I like the 
RoR idea of "requirements" as well*. I think that'd make a great addition.

I think I found a bug though. Given these patterns:

    routeManager = new RouteManager()
      .addRoute("feed", "/:collection", TargetType.TYPE_COLLECTION)
      .addRoute("entry", "/:collection/:entry", TargetType.TYPE_ENTRY);

When do a resolution of the URL "/mycollection" I get back a match on 
the "entry" route inside RouteManager.resolve(). It seems to me that the 
"entry" route should not match at all. I'm just digging into the whole 
regexp thing, but as I'm not a huge regexp expert, the code is a bit 
hard for me to read (would be great if you could add a few comments to 
Route.compile()). Any thoughts?

- Dan


Dan Diephouse
http://mulesource.com | http://netzooid.com/blog

View raw message