Hello,
I am busy integrating the Restlet API with servlets and Spring. For the
Spring part access to a servlet's context (javax.servlet.ServletContext) is
required. Using the Restlet extension ServletContext (
com.noelios.restlet.ext.servlet.ServletContext) the code would look like:
public void setContext(Context context) {
super.setContext(context);
if (context instanceof
com.noelios.restlet.ext.servlet.ServletContext) {
com.noelios.restlet.ext.servlet.ServletContext tmpContext =
(com.noelios.restlet.ext.servlet.ServletContext)
context;
Servlet servlet = tmpContext.getServlet();
javax.servlet.ServletContext servletContext =
servlet.getServletConfig().getServletContext();
WebApplicationContext tmp = (WebApplicationContext)
servletContext.getAttribute(contextAttribute);
}
}
However, the 'getServlet()' method in
com.noelios.restlet.ext.servlet.ServletContext is private. In order to make
this work I've changed the access modifier to public. Is it possible to
change the signature to public permanently? If not, what would be the
preferred way to get a reference to the javax.servlet.ServletContext?
Have a nice day,
Marcel
BTW, a full description of the Restlet-Servlet-Spring integration will
follow as soon as possible.