After reading the documentation and trying several things I am still
confused. Does someone have an up to date example of a servlet that
would be called from a ServletModule?

The documentation on the ServletModule in the user's guide seems to be
contradictory. There is this:

"Note: Every servlet (or filter) is required to be a @Singleton. If
you cannot annotate the class directly, you must bind it using
bind(..).in(Singleton.class), separate to the filter() or servlet()
rules. Mapping under any other scope is an error. This is to maintain
consistency with the Servlet specification."


which seems to imply that you can integrate a third party servlet into
your web app by binding it as a singleton. And then there is this:

"Each servlet configured with a ServletModule is executed within
RequestScope.

By default, there are several elements available to be injected, each
of which is bound in RequestScope:

    * HttpServletRequest / ServletRequest
    * HttpServletResponse / ServletResponse
    * @RequestParameters Map<String, String[]>

Remember to use a Provider when injecting either of these elements if
the injection point is on a class that is created outside of
RequestScope. For example, a singleton servlet is created outside of a
request, and so it needs to call Provider.get() on any RequestScoped
dependency only after the request is received (typically it its
service() method. "


which seems to suggest that in a Singleton Servlet (which they all
are?), you can only get at the request, response, and ServletContext
(how?) by using Providers, which you sort of can't do if you are using
a servlet over which you have no control.

Be that as it may, I can't even figure out what a servlet that I'm
writing should look like.

Any help would be appreciated;

Garey Mills
Library Systems Office
UC Berkeley

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