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