In OpenRasta, how am I supposed to register resources with three different codecs and access these codecs through a regular web browser by appending an extension to the URL? The following doesn't seem to work:
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>();
UserListResource is registered and made available as text/html in a regular web browser, but appending .xml to the URL just gives me a 404. I've tried this:
ResourceSpace.Has
// UserListResource inherits ResourceBase
.ResourcesOfType<UserListResource>()
.AtUri("/users")
.And.AtUri("/users.xml")
.HandledBy<UserHandler>();
But that only gives me the same text/html representation on both /users and /users.xml.