> -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Stokes > Sent: 05 March 2007 20:27 > To: [email protected] > Subject: Re: mapping domain objects to resources > > Makunas, Michael <Makunas.Michael <at> mtvne.com> writes: > > My question is where do people generally put the logic for determining > > something like the value of the href attribute? > > What I'm leaning towards for a solution is a single utility class that can > determine the canonical URL for a given domain object. This would be > configured > with a Map of class-names to url-patterns. This might be the > one-center-of-ugliness pattern, but I'm using Spring to wire up my Router, > so I > can at least put all the configuration of URLs to Restlets near (in XML) > the > configuration of the reverse mappings of domain objects to URLs. > When I get into my "list" controllers (in your example, whatever Finder > returns > a list of Foos), it's just too convenient to have an authority that can be > given > a domain object and hand me it's authoritative location.
Sounds like you're using Spring and Restlet much the same way we are. I feel pretty strongly now that logic belongs in resource classes and we'll probably go with a spring bean as a "one-center-of-ugliness" (great name!) to the hold the rules in one central place. That leaves us in a state where the class responsibilities are properly aligned and as we get a little more experienced with Restlet, we can refactor how we apply those responsibilities without too much pain. -Michael

