views:

89

answers:

1

I have routes like "x/{*path}" where the path parameter is used by the controller to navigate a tree structure to end up with a resource which is served to the client.

I would now like to extend this scheme in an orthogonal fashion with other controllers that provide other "aspects" of the resource such as meta-data or a thumbnail. It should be possible to add these other controllers so that the main controller does not have to be aware of their existence. I was planning to use routes like "x/{*path}/y" to index these aspects but the routing system will not accept such paths.

I could use a constraint to only match my additional routes if the path parameter ends in "/y" for example but then the controller would have to be aware of the "extension" added to be able to remove it when parsing the path - this is not acceptable.

Am I forced to write my own Route?

+1  A: 

Two solutions:

  1. Use x/y/{*path} instead.
  2. Continue using x/{*path}, but when you read the path parameter, check for the /y and act accordingly
Eduardo Molteni