You could do this by defining a custom Finder that creates an instance of a
Resource of the appropriate subclass of Asset, assetType, given the request
URI /Asset/{assetType}/{id}.
But is it really necessary to have a resource type hierarchy that directly
mirrors your business domain?  Why not just have an Asset field of
AssetResource that you initialize with AssetA, AssetB, or someone else's
subclass based on an {assetType} parameter?

--tim


On Thu, Feb 26, 2009 at 7:53 PM, limss <[email protected]> wrote:

> For example, I have define AssetA and AssetB which are both inherit from
> Asset. So I may access to AssetA by /Asset/A/{id} and AssetB by
> /Asset/B/{id}. In this case I need to define AssetAResource and
> AssetBResource.
>
> Now other developer wanted to introduce another customized Asset, says
> AssetC inherits Asset, so a AssetCResource is defined and assuming that
> user
> should be able to access to AssetC by /Asset/C/{id}, how can I assure that
> when AssetC is added, I do not need to attach the uriPattern /Asset/C/{id}
> to the router manually.
>
>
> Thierry Boileau wrote:
> >
> > Hello limss,
> >
> > so, you are aware the world of resources and domain objects are not the
> > same. Good point.
> > Just a few words on how to design your REST interface. You must define
> > the resource you want to expose, give them name (URIs), define the
> > methods (let's say HTTP methods : GET, PUT, DELETE, POST) you want to
> > apply on them, the kind of representations you want to exchange with
> them.
> > Having said that, what do you mean by "User are allowed to add on any
> > new ObjectA3" ? Which resource is called? Is there a "container"
> resource?
> >
> > Best regards,
> > Thierry Boileau
> >
> >> Currently I have a few objects (ObjectA1, ObjectA2) that are inherit
> from
> >> parent class ObjectA. User are allowed to add on any new ObjectA3 as
> long
> >> as
> >> they are inherited from ObjectA.
> >>
> >> May I know what would be the best way to define the URL pattern as well
> >> as
> >> Resource so that when new Objects added in, I do not need to add in the
> >> new
> >> binding to the Router ?
> >>
> >
> > ------------------------------------------------------
> >
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1233165
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Generic-URI-pattern-and-Resource-tp2388390p2393178.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1235732
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1238393

Reply via email to