Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-415

Add Guice injector to servlet context to allow integration with other tools/servlets/filters

XMLWordPrintable

    • Icon: Patch Patch
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 1.2.1.GA
    • jaxrs

      The GuiceResteasyBootstrapServletContextListener creates modules and Guice injector that is used to initialize resources. The injector is then left for garbage collection.

      There are situations when you would like to use a single instance of a Guice module throughout your application. For example another ServletContextListener needs to do some initialization of guice managed objects. Or the guice managed objects are needed in a servlet.

      The very simple attached patch modifies the GuiceResteasyBootstrapServletContextListener in a way that the Injector is placed to the ServletContext. This is very similar to a way how GuiceServletContextListener (http://code.google.com/p/google-guice/source/browse/tags/2.0/servlet/src/com/google/inject/servlet/GuiceServletContextListener.java) does this. Therefore someone can use the GuiceFilter if he needs it etc.

      The patch also includes a test case.

            rsigal@redhat.com Ronald Sigal
            galet_jira Michal Galet (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: