Justin S.,
Finder looks to me like a per-request Resource factory. How it generates the Resources is of no concern to the rest of the framework. My example just delegates the creation of the Resource to Spring. (I guess that is "outside the Restlet API".) There is some overhead of asking Spring for a bean by its type and wiring (though not initializing) the collaborators. However, I think these are out- weighed by the overall simplicity of the integration between RESTlet and Spring and fully leveraging Spring's IoC capabilities. At least from my understanding of Spring, to get a bean Resource wired with its collaborators you have to define that bean and its dependencies up front (i.e. in a Spring ApplicationContext). If you just wire your Restlet, you'd have to manage all of the Resource's collaborators each time you instantiate it.
I'd be interested in hearing others' take.

Justin M.

--
troove Inc.
http://troove.net/


On Sep 7, 2007, at 11:36 AM, Stanczak Group wrote:

Ok. I've looked it over and the question I have is doesn't this approach put you outside the Restlet API? And, would it be better to just create Restlets instead of Resources? The way I understand the document is that Resources get loaded every time, but Restlets are loaded once? Is this correct?

Justin Makeig wrote:
Justin S.,
Take a look at some of the Spring integration that other folks have done. (Substitute "IoC framework" for "Spring" and you'll get the idea.) You can find my Spring-based solution at <http:// article.gmane.org/gmane.comp.java.restlet/2943>. It overrides the Finder's createResource method to create (request-scoped) Resources using Spring.

Justin M.



--
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

Reply via email to