Hi there, Thanks for providing such a detailed feed-back. That helps to understand how people actually use the framework and what are the pain points.
Your approach works but has a drawback. If at some point later you prefer to run your application as a standalone application instead of embedded in a Servlet container, then you will have to port it to use the provided SpringContext which works in both cases. Best regards, Jerome > -----Message d'origine----- > De : news [mailto:[EMAIL PROTECTED] De la part de shlok > Envoyé : mardi 27 février 2007 22:29 > À : [email protected] > Objet : Finally got Restlet and Spring working using > Webapplication Context > > I have been working on spring based server that has few > servlets [DWR, OpenAmf, Spring's MVC and Hibernate]. > I needed to use Rest for providing API functionality. > Problem: > The examples in Wiki demonstrate loading spring beans > and accessing them using Spring Extension and Spring context. > When I started working, I missed it andeventually got it working > and it works fine. > > I have few questions / doubts though. > > What I do? > I am using spring's > WebApplicationContextUtils.getWebApplicationContext() > to get the spring context (hence I am using already > available functionality and do not > need Spring extension). For this to work, I just made > 2 minor changes: > 1. Added ServletContext attribute to Application class. > 2. In ServerServlet class, I simply do > application.setServletContext(getServletContext()). > 3. In my RestApplication extends Application createRoot(), > I simply do getSpringContext() and pass it to > WebApplicationContextUtils. > > I would like to know, if this approach is good? > It helps me in a huge way, as I was able to wire > Targets in my application.xml, which directly > reference beans in appServices. All these XMLs as > listed in web.xml context-param <contextConfigLocation>. > It provides me uniform wiring, as previous contexts. > Furthermore, following spring's philosophy, the > application.xml is now in web.xml, instead of > hard-coded in the RestApplication class. > > I am not sure which is better approach? Is having > ServletContext in Application ok? > All in all, Restlet is a wonderful framework, thanks a lot Jerome.

