I tried that, but the map of attributes for the context was empty. I had to obtain the context getServerDispatcher().getContext() in order to get a populated attribute map.
Ben On Wed, Dec 2, 2009 at 10:15 AM, Ben R Vesco <[email protected]> wrote: > I'm also interested to know if there's a better way, but you can also > shorten that a bit to: > > ServletContext sc = (ServletContext) > getContext().getAttributes().get("org.restlet.ext.servlet.ServletContext"); > > > > On Wed, Dec 2, 2009 at 8:57 AM, BenT <[email protected]> wrote: > > In restlet 2.0-M5, from a ServerResource attached to a router used as the > > root of a SpringComponent and served from a SpringServerServlet, I had to > do > > the following to get the ServletContext: > > > > ServletContext servletContext = (ServletContext) > > getContext().getServerDispatcher().getContext() > > .getAttributes().get("org.restlet.ext.servlet.ServletContext"); > > > > > > Is this the recommended way to get the ServletContext? > > > > Ben > > -- > > View this message in context: > http://n2.nabble.com/Obtaining-ServletContext-in-2-0-M5-tp4100861p4100861.html > > Sent from the Restlet Discuss mailing list archive at Nabble.com. > > > > ------------------------------------------------------ > > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2426398 > > > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2426422 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2426537

