Hi Rahul, On Sep 15, 2009, at 8:54 AM, Rahul Juneja wrote:
> Rhett, > > I tried the following things in ServerResource File. anyways thats > ok but i have a question about why Restlet doesn't expose the > Servlet context which is one of the attributes added to the context > of the application. "org.restlet.ext.servlet.ServletContext" ? Do you mean "why doesn't Restlet expose the ServletContext in the ServerResource API"? Because that would create a dependency in Restlet core on a JEE class. Restlet core is designed to run without JEE. Rhett > > Thanks, > Rahul > > On Mon, Sep 14, 2009 at 5:39 PM, Rhett Sutphin <rh...@detailedbalance.net > > wrote: > Hi Rahul, > > On Sep 13, 2009, at 11:39 AM, Rahul Juneja wrote: > > > I wanted to get some spring injected beans in my resource file. and > > i have looked at the integration with spring in other ways but i > > would not be very interested in that as i want to keep spring > > separate from restlet. Also i am aware of the concern that this way > > my application will be tied to Servlet api. but i think i am fine > > with that as i will be running on tomcat only. > > > > I looked at "SpringServerServlet" and tried calling > > getWebApplicationContext() or getServletContext() but in both the > > cases i am getting exception. I did not do anything else. except > > calling this method from the resource file. Is there any other steps > > i need to follow to get the springContext or webappllication context > > to get the beans from the spring. > > getServletContext() inside a servlet is provided by the JEE API. If > that's throwing an exception, you have a non-restlet-related problem. > > I'm not so familiar with SpringServerServlet, but it appears that it > is loading the spring application context from the standard (for > spring) JEE location. Are you loading the application context using > ContextLoaderListener? > > You might also try out RestletFrameworkServlet. It allows you to > configure restlet in approximately the same way you configure Spring > MVC. > > Again, though, if you can't invoke getServletContext() from inside a > servlet, none of these solutions are going to work for you. > > Rhett > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2394793 > > > > -- > Rahul Juneja > Phone : (631) 681-9996 > Fax : (206) 339-9047 > http://techlabs.thoughtclicks.com > http://finance.thoughtclicks.com > --------------------------------------------------------------------------- > The thing always happens that you really believe in; > and the belief in a thing makes it happen. ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2395203