google / guice

Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
https://github.com/google/guice
Apache License 2.0
12.5k stars 1.67k forks source link

Servlet as a Filter in OSGi #495

Open gissuebot opened 10 years ago

gissuebot commented 10 years ago

From ts.marsh on June 17, 2010 12:09:59

Hi,

I've been trying to get guice to work with Sling for a project.  All was going fine until I hit a couple of stories that really needed RequestScoping.

I could add the filter in the web.xml, but that doesn't feel very OSGi.  I'd rather deploy it as a bundle and allow sling to find it.

The way Sling recommends doing this is using the SCR maven plugin, which is tricky as the servlet jar uses Ant.  I could of course configure it manually.

Is this work something the community would be interested in?  If so, would you prefer if I convert the project to maven (I suspect not), or just create the xml configuration manually. Failing that is there anyone with more OSGi experience that has a better suggestion?

Thanks

Original issue: http://code.google.com/p/google-guice/issues/detail?id=495

gissuebot commented 10 years ago

From mcculls on June 17, 2010 09:17:13

FYI, the Bnd Tool ( http://aqute.biz/Code/Bnd ) which is already used in the Guice build supports generation of Declarative Services XML (ie. like the SCR plugin) by using the Service-Component header ( http://aqute.biz/Code/Bnd#component ).

But I'm not sure why you need Declarative Services XML though, as trunk already builds the servlet extension as an OSGi fragment that will automatically attach to the Guice bundle... just deploy the various jars and you're good to go.

gissuebot commented 10 years ago

From ts.marsh on June 17, 2010 11:27:06

My reading of the servlet manifest is that it just makes the packages available for import and doesn't expose the GuiceFilter as a service or give clues to frameworks, like Sling, for automatic initialization.

The example I'm working from is here: http://www.jcrdev.com/jcrdev/blogs.postview.html?nd=writing_filters_in_a .

gissuebot commented 10 years ago

From sberlin on February 21, 2011 17:44:03

(No comment was entered for this change.)

Labels: Extension-Servlet