simonthorogood edited this page Dec 18, 2010 · 4 revisions

Use ResourceSpace.Has to define what your web application will serve in terms of resources. ResourceSpace.Has is merely a stem from which a variety of fluent configuration expressions can flow. It is therefore difficult to document in reference form such that it resembles a real configuration – you may prefer to learn about it from the Configuration How Tos.


This is the primary means of configuring OpenRasta. More than one .ResourcesOfType<TResource> can exist for the same type, but OpenRasta will attempt to combine the two definitions. It is therefore not possible to have ResourcesOfType<TResource> twice with the same type and the same handler as defined later by .HandledBy<THandler>().




This definition follows ResourceSpace.Has.ResourcesOfType<TResource>() and is used to tell OpenRasta what URI a particular resource will be served from. The string parameter takes a URI template, which is a URI which has zero or more replaceable parts signified by curly braces, for example /customers/{id}. Multiple URIs may be registered using a ’’’repeatable definition’’’ using .And.

.And – repeatable definitions

.And may be used following .AtUri(string) to indicate that there is more than one URI associated with this resource type. It may also be used following .HandledBy<THandler>() to specify multiple handlers (not common) ’’’and’’’ after TranscodedBy<TCodec>(object) or any of its sub-definitions to indicate multiple transcodings (very common) for a resource.


This definition follows .AtUri(string) and is used to tell OpenRasta that there is a handler whose concrete type is THandler which has on it methods which OpenRasta may use to serve representations of resources.


This definition follows a .HandledBy<THandler>() definition and is used to tell OpenRasta what objects will transcode the resources into their wire representations. The object parameter is a configuration object whose use differs depending on the codec. Some codecs, such as the JsonDataContractCodec require this but do not use it. It’s acceptable to pass null in many circumstances, but check the documentation for the codec you are using.

See also