GuiceServletContextListener.getInjector should have one param: servletContext
145 views
Skip to first unread message
Rex Sheng
unread,
Feb 26, 2009, 10:06:30 AM2/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-guice
Hi, Dhanji,
How getInjector() get to know about the servletContext, when sometime
we measure relative paths at that point?
So, in my projects, I replaced it with getInjector(ServletContext sc).
Is this right?
Thanks,
Rex
Dhanji R. Prasanna
unread,
Feb 26, 2009, 5:40:30 PM2/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
Hmm.. The ServletContext is accessible from @Inject anywhere--does this solve your problem? Or do you require it inside the module?
Dhanji.
Rex Sheng
unread,
Feb 26, 2009, 9:21:28 PM2/26/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-guice
Yes, modules. My widget module should init with servletContextPath.
Sure, I can get it by using @Providers mechanism or so. But it's not
clear to the module: 'when the sc is provided', or 'what if the sc is
null by that time?'
Rex
Dhanji R. Prasanna
unread,
Feb 27, 2009, 1:59:27 AM2/27/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
Hmm, yea you're right. Well you can just override contextInitialized() instead, this is what calls getInjector().
Gian Marco Gherardi
unread,
Jan 29, 2011, 1:42:35 PM1/29/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
+1 for having ServletContext or ServletContextEvent as a parameter to GuiceServletContextListener.getInjector()
Gian Marco Gherardi
unread,
Feb 16, 2011, 11:06:30 AM2/16/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message