Hi, thx for all your responses. But this will not work because I need to have the location when getInjector() is called. I need to pass the location to my AbstractModule.
Any other ideas ? Thx, Norman 2009/9/7 hezjing <[email protected]>: > Hi Norman and Dhanji > Allow me to chip-in the code example and see if I follow the discussion > correctly :-) > The solution described by Dhanji would be: > public class MyServletConfig extends GuiceServletContextListener { > �...@override > public void contextInitialized(ServletContextEvent servletContextEvent) > { > String s = > servletContextEvent.getServletContext().getRealPath("WEB-INF/conf/config.properties"); > // s = "C:\Project\war\WEB-INF\conf\config.properties" > } > } > > On Mon, Sep 7, 2009 at 6:29 AM, Dhanji R. Prasanna <[email protected]> wrote: >> >> If you create your Injector in a GuiceServletContextListener (see user's >> guide on Servlets) you have access to the ServletContext and can use it the >> way you are used to. >> Dhanji. >> >> On Mon, Sep 7, 2009 at 2:07 AM, Norman Maurer <[email protected]> wrote: >>> >>> Hi all, >>> >>> im currently using Guice to serve my gwt rpc service. I want to >>> inject some vars via Properties. This works fine with: >>> >>> Names.bindProperties(binder(), properties); >>> >>> Now I would like to load the properties file from >>> /path/to/the/webapp/WEB-INF/conf/config.properties. How would I get >>> the "/path/to/the/webapp/WEB-INF". Normally I would do it via >>> ServletConfig but this is not possible because its in the >>> AbstractModule.. >>> >>> Thx, >>> Norman >>> >>> >> >> >> > > > > -- > > Hez > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
