I want to register mutliple resources with one handler and one URI.so want to confirm that is this possible in open rasta. I have gone through a bit of websites regarding open rasta but couldn't able to conclude that whether this is possible or not?
ResourceSpace.Has
.ResourcesOfType<Request>()
.AtUri("/processing")
.HandledBy<SomeHandler>()
.TranscodedBy<SomeCodec>();
I need to handle all the request which are derived from the base class "Request". It would be great if some body could actually shed light on this.
So if everything is a request and you want to tunnel stuff, you can, using the registration you have provided.
The matching will be done based on the most approaching type, so
That said, be aware that in ReSTful system we tend to try and identify different things with different URIs, leading to one registration per type.
In my fairly limited experience of OpenRasta you can use the .And method to add additional .AtUri resource locations.
I.e. in your case
where the {curley brackets} specify the input parameter of your Handler method i.e.:
I found in the OpenRasta documentation a note which specifed that you MUST have destinct (only one) ResourceSpace definition for each matching Type and Handler. In other words you must not duplicate the same ResourceOfType class with the same HandledBy handler class. I tested this and it is the case and perhaps why you are asking the question in the first place.
N.b. this code is completely untested, I've just taken the patern of what I've written and substituted in your classes and uri where known. This also assumes you are trying to retrieve data from a HTTP GET verb. The other contributer, went down the POST route, but you haven't specified.