openrasta - 在 OpenRasta 中,如何配置一个 URI,其中我将 "the remainder of the path"作为单个字符串获取?

标签 openrasta

通常在 OpenRasta 中有这样的配置:

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

... 其中路径的 {region} 部分自动映射到处理方法中的字符串参数。因此,如果用户点击:

http://server/customers/region/emea

然后向处理程序方法传递字符串“emea”。

除了这样做,我还想用这样的东西注册一个处理程序:

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

在这个假想的语法中,星号表示“将路径的其余部分(包括斜杠)作为单个字符串参数传递给处理方法”。因此,如果用户点击:

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

然后我的处理程序方法接收一个字符串参数:

how/about/this?that=other

在 OpenRasta 中这样的事情可能吗?

在 Sinatra (Ruby) 中,我会使用正则表达式来完成此操作。

更新:到目前为止,我的猜测是自定义管道以某种方式修改路径以伪装斜杠...

最佳答案

trac 上有一个补丁可以将此功能添加到 RC 分支。

我将在本周末将这些更改作为 RC2 推送,因此您将获得通配符语法。

请注意,它看起来像/{name:*}

关于openrasta - 在 OpenRasta 中,如何配置一个 URI,其中我将 "the remainder of the path"作为单个字符串获取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2699765/

相关文章:

rest - 使用 OpenRasta 将图像作为流或字节数组获取

ajax - Openrasta 数据序列化问题

components - 用于基于组件(或复合)的 Web 应用程序的 OpenRasta 框架

methods - Openrasta 的 Get 方法在资源处理程序中的优先级问题

.net - 在 OpenRasta 中是否可以模式匹配多个键/值对?

openrasta - OpenRasta入门

dependency-injection - Orchard CMS : Creating module for OpenRasta, 依赖注入(inject)问题

c# - OpenRasta 可以与现有的 Web 应用程序一起运行吗?

java - 是否有类似 Java REST 框架的 OpenRasta?