In OpenRasta, how do I configure a URI where I get "the remainder of the path" as a single string?

Posted by Daniel Earwicker on Stack Overflow See other posts from Stack Overflow or by Daniel Earwicker
Published on 2010-04-23T15:22:01Z Indexed on 2010/04/23 15:23 UTC
Read the original article Hit count: 356

Filed under:

Normally in OpenRasta there is some configuration like this:

ResourceSpace.Has.ResourcesOfType<Customers>()
    .AtUri("/customers/region/{region}")
    ... // and so on

... where the {region} part of the path is automatically mapped to a string parameter in the handling method. So if the user hits:

http://server/customers/region/emea

Then the handler method is passed the string "emea".

As well as doing this, I'd like to register a handler with something like this:

ResourceSpace.Has.ResourcesOfType<Customers>()
    .AtUri("/someotherthing/*")
    ... // and so on

In this imaginary syntax, the asterisk would mean "take the rest of the path, including slashes, to be a single string parameter to pass to the handling method". And so if the user hits:

http://server/someotherthing/how/about/this?that=other

Then my handler method receives a string parameter:

how/about/this?that=other

Is such a thing possible in OpenRasta?

In Sinatra (Ruby) I'd use a regular expression to do exactly this.

© Stack Overflow or respective owner

Related posts about openrasta