4
votes

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?

1

1 Answers

0
votes

I don't know about Listeners, but to manage the servlet context, it's very simple. In your ServletModule.configureServlets() :

getServletContext().setAttribute("productionMode", "true");