[jboss-jira] [JBoss JIRA] Reopened: (JBAS-8387) support injection for a servlet that is registered programmatically

Jason Greene (JIRA) jira-events at lists.jboss.org
Thu Apr 21 14:26:34 EDT 2011


     [ https://issues.jboss.org/browse/JBAS-8387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Greene reopened JBAS-8387:
--------------------------------



Due to feedback from the community, I have split the AS7 and AS6 projects and reopened all unscheduled AS6 issues that are a year or less old. This will make it easier community members to find and work on them.

Future releases beyond 6.1 can be done provided a community member steps up to coordinate them.

> support injection for a servlet that is registered programmatically
> -------------------------------------------------------------------
>
>                 Key: JBAS-8387
>                 URL: https://issues.jboss.org/browse/JBAS-8387
>             Project: Legacy JBoss Application Server 6 
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Weld/CDI
>    Affects Versions: 6.0.0.M4
>            Reporter: Marcel Kolsteren
>            Assignee: Marius Bogoevici
>             Fix For: No Release
>
>         Attachments: servlet-injection-problem.zip
>
>
> Injection of a CDI Managed Bean into a servlet works for servlets that are registered using web.xml, but fails for servlets that are registered using the addServlet() method of the servlet context. Supporting injection in both cases would be more consistent and more convenient for developers.
> In order to demonstrate this issue, I created an Arquillian test for a managed JBoss M4 application server. The test deploys a war-file that contains two servlets. Both servlets refer to the same servlet class. The servlet class is very simple: it has a field into which a request scoped bean is injected, and it reports to the client whether or not this field contains a null value. The first servlet is defined in the web.xml file, the second servlet is registered programmatically by calling ServletContext.addServlet. The test cases show that the first servlet works as expected. However, the second servlet detects a null value in the field that should contain an injected instance of the request scoped bean. Steps for reproduction:
> unpack the attached zip file
> export JAVA_HOME = <home of your JDK>
> export JBOSS_HOME = <root directory of your JBoss 6 M4 server>
> mvn test

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list