开发者

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

Normally in OpenRasta there is some configuration like this:

ResourceSpace.Has.ResourcesOfType<Customers>()
 开发者_JAVA百科   .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.

Update: My guess so far is a custom pipeline that munges the path to disguise the slashes somehow...


There's a patch on trac to add this functionality to the RC branch.

I'll be pushing those changes as an RC2 this weekend, so you'll get the wildcard syntax.

Note that it's going to look like /{name:*}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜