Thanks for the suggestion.
I'm afraid I was not clear enough.
The bindListener method you suggest is not binding a web.xml listener (eg.
a HttpSessionListener). It is binding a guice aop listener
The setAttribute method does not set context params but an attribute.
My problem is, that I need to configure a external dependency to my system.
This external code requires a certain context param to be present (not an
init param for the servlet, but a "global" context param). It also requires
a certain HttpSessionListener to be put to web.xml.
I would very much like not to have to change my web.xml just to add this
external dependency.
- Mathias
Den onsdag den 26. september 2012 11.14.31 UTC+2 skrev Mikael Couzic:
>
> It's actually quite simple.
>
> In your ServletModule.configureServlets(), you have all the methods that
> you need :
>
> -
>
> bindListener(typeMatcher, listener);
> -
>
> getServletContext().setAttribute("productionMode", "true");
>
>
> On Wednesday, September 12, 2012 9:04:42 AM UTC+2, Mathias Birkkjær
> Nielsen wrote:
>>
>> I'm working on a web project using guice and guice servlet. I've already
>> setup both guice filter and listener.
>>
>> With this setup I can emulate web.xml filters and servlets in a
>> servletmodule using the serve(...) and filter(...) methods.
>>
>> Now the question:
>>
>> On the guice servlet page they claim that web.xml is no longer needed,
>> but I have failed at figuring out how to:
>>
>> register contextlisteners (listener-tag in web.xml) and
>>
>> Add context-param (I an able to setup init-param thou)
>>
>> Is this even possible with guice servlet?
>>
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-guice/-/Ad3zdwaC2U8J.
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.