Hi Jonathan,
Beside the URI design recommendations with which I agree, the router should
work as expected with FIRST routing mode.
I've tested tutorial Part 11 with a modified router:
// Attach the handlers to the root router
router.attach("/users/{user}", account).getTemplate()
.setMatchingMode(Template.MODE_EQUALS);
router.attach("/users/{user}/order/list", orders);
router.attach("/users/{user}/order/{order}", order);
router.setRoutingMode(Router.FIRST);
It worked fine. I've also tested this which works too and is simpler:
// Attach the handlers to the root router
router.attach("/users/{user}", account);
router.attach("/users/{user}/order/list", orders);
router.attach("/users/{user}/order/{order}", order);
Please enter a bug report if you observe a different behavior.
Best regards,
Jerome
> -----Message d'origine-----
> De : Jonathan Hall [mailto:[EMAIL PROTECTED]
> Envoyé : vendredi 8 juin 2007 17:30
> À : [email protected]
> Objet : URI matching again
>
> Hi,
>
> Is it possible to do this:
>
> /user
> /user/{id}
> /user/list
>
> The problem comes from the app thinking list is just a {id}
> variable.
> I thought router.setRoutingMode(Router.FIRST) sounded like it
> would pick
> the route I wished by the order they were attached.
> In which case this would work:
>
> /user
> /user/list
> /user/{id}
>
> However, it seems to not work like that. No matter what
> order I attach
> the routes they seem to end up in the same order in a
> RouteList. I also
> need to have optional parameters attached to all of the urls.
>
>
> Any ideas?
>
> Best Regards,
>
> Jon
>