Created
August 1, 2012 08:10
-
-
Save asbjornu/3224849 to your computer and use it in GitHub Desktop.
OpenRasta resource registration with codecs for three different MIME types and extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MediaType json = MediaType.Json.WithQuality(1f); | |
MediaType xml = MediaType.Xml.WithQuality(0.9f); | |
MediaType html = MediaType.Html.WithQuality(0.1f); | |
ResourceSpace.Has | |
.ResourcesOfType<ResourceBase>() | |
.WithoutUri | |
.TranscodedBy<MyXmlCodec>().ForMediaType(xml).ForExtension("xml") | |
.And.TranscodedBy<MyHtmlCodec>().ForMediaType(html).ForExtension("html") | |
.And.TranscodedBy<JsonDataContractCodec>().ForMediaType(json).ForExtension("json"); | |
ResourceSpace.Has | |
// UserListResource inherits ResourceBase | |
.ResourcesOfType<UserListResource>() | |
.AtUri("/users") | |
.HandledBy<UserHandler>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment