[weld-dev] Injection into servlets, filters etc. for Jetty

Matija Mazi matija.mazi at gmail.com
Thu Feb 18 05:26:20 EST 2010


Hi,

 

I've done some work on injection into servlets and filters for Jetty 6. Here's what I've come up with so far – the patch (to be applied to weld/servlet/trunk) is attached; I'll also attach it to the Jira issue (https://jira.jboss.org/jira/browse/WELDX-23).

 

This includes injection into Servlets and Filters, but not Listeners. It adds a sub-module weld-jetty-support to the weld-servlet module and changes some stuff in the weld-servlet-int module. To use it you need to:

- add weld-jetty-support.jar to JETTY_HOME/lib

- package the new weld-servlet.jar with your war/WEB-INF/lib (as normally)

- deploy your web app into Jetty

- change the attached myapp-context.xml to refer to your web app and deploy it into JETTY_HOME/contexts

 

Here are some open issues that remain and need some discussion. Which of these should I work on first?

 

1.      Injection into Listeners. As far as I could see, this isn't yet supported even in Tomcat? I've done some work on this for Jetty 6 (not yet included in the attached patch) and I think it can be done (using javassist to add the injection code into the first lifecycle method called on the listener).

2.      I don't like the fact that you need to deploy two files into Jetty, the war and the contexts/*.xml, but I don't think there's another way since the jetty example for using annotation injection does the same.

3.      I haven't provided any tests for Jetty integration. There is a jboss-test-harness-tomcat but nothing similar for Jetty. Maybe I could create a jboss-test-harness-jetty and use it to create Weld-Jetty integration tests.

4.      This works for Jetty 6; I haven't tried Jetty 7.

5.      I didn't do for Jetty anything similar to JspInitialization (supposed to replace the el.ExpressionFactory) in tomcat-support; how is this used?

6.      Servlet injection doesn't work in Tomcat 7 (https://jira.jboss.org/jira/browse/WELDX-45); I think I should be able to fix this easily now.

 

Regards,

Matija

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20100218/929a4296/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jetty-injection.patch
Type: application/octet-stream
Size: 26476 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/weld-dev/attachments/20100218/929a4296/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myapp-context.xml
Type: text/xml
Size: 1401 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/weld-dev/attachments/20100218/929a4296/attachment-0001.xml 


More information about the weld-dev mailing list