Hi,
Get the path when the context initializes in the event listener and
send it up to the ServletModule. You can then use it in other
AbstractModules you are implementing and installing in your
ServletModule.
I hope this helps:
public class MyServletConfig extends GuiceServletContextListener {
private String path;
@Override
public void contextInitialized(ServletContextEvent
servletContextEvent) {
this.path =
servletContextEvent.getServletContext().getRealPath("/");
}
@Override
protected Injector getInjector() {
return Guice.createInjector(new MyServletModule(path));
}
}
~Mihai