getInjector() is called from contextInitialized, so you can put the call to
super.contextInitiazed() after you do your work with the paths:
http://www.google.com/codesearch/p?hl=en&sa=N&cd=1&ct=rc#rd__TNh_ZrM/svn/trunk/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java&q=GuiceServletContextListener
\.java%20package:http://google-guice\.googlecode\.com&l=37

Dhanji

On Mon, Sep 7, 2009 at 7:24 PM, Norman Maurer <[email protected]> wrote:

>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to