Export to GitHub

wave-protocol - issue #235

Facilitate the registration of other servlets and the injection of WIAB instances


Posted on Mar 4, 2011 by Quick Hippo

In other to integrate WIAB with other projects or to extend it easily, it will be useful to permit the: - use of the same Guice injector (the last created child injector), - the injection of WIAB instances in other projects code - and to permit to register other servlets via an optional web.xml

This can be accomplished by adding an attribute in the context with the injector, and also using WebAppContext instead of the ServletContextHandler.

In the web.xml we can register other servlets/filters and for instance we can use GuiceFilter: https://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/servlet/GuiceFilter.html

and inject and reuse the WIAB instances in other projects that want to integrate WIAB.

This is the way we are integrating WIAB in our project (that also use Guice) and our proposal to facilitate the integration of other server codes. I think that can be useful for other projects or a start point.

A proposed patch: http://codereview.waveprotocol.org/552005

Comment #1

Posted on Mar 6, 2011 by Quick Hippo

Some samples to test the previous patch (if you want to test it, you will need guice-servlet as an additional dependency).

Attachments

Comment #2

Posted on Mar 25, 2011 by Happy Cat

Fixed by 925:c6765f3b3f67

Status: Fixed

Labels:
Type-Defect Priority-Medium