[MonoRail] trying new routing engine

4 views
Skip to first unread message

Gauthier Segay

unread,
Jan 8, 2008, 10:54:58 AM1/8/08
to Castle Project Users
Hi,

I'm experiencing new MonoRail routing module
(Castle.MonoRail.Framework.Routing.RoutingModuleEx), I've successfully
added my first route and have some questions:

1:
with following route registration:

Castle.MonoRail.Framework.Routing.RoutingModuleEx.Engine.Add(
new PatternRoute("/an/arbitrarypath/<id>/<action>.castle")
.DefaultForController().Is("anarbitrarycontrollername")
.DefaultForArea().Is("anarbitraryarea")
.DefaultForAction().Is("detail")
);

It match ok for for /an/arbitrarypath/anid/detail.castle

but it doesn't for /an/arbitrarypath/an.id.with.dot.in.it/
detail.castle

it fails as 'Controller not found. Area: 'an/arbitrarypath' Controller
Name: 'an.id.with.dot.in.it'

so either my route is weak or the module can't match <id> containing
dot in it, so rule is not matched then default routing apply.

is it expected or a bug?

2:is the following code correct to obtain route information

RouteMatch match = Context.Items["route.match"] as RouteMatch;
if(match != null && match.Parameters.ContainsKey("id")) // do
something with match.Parameters["id"]

or is there an easier way?

Thanks for your support.
Reply all
Reply to author
Forward
0 new messages