You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/09/16 07:49:46 UTC
DO NOT REPLY [Bug 49937] New: Problems with AsyncListener and
resource injection
https://issues.apache.org/bugzilla/show_bug.cgi?id=49937
Summary: Problems with AsyncListener and resource injection
Product: Tomcat 7
Version: trunk
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: djencks@apache.org
Created an attachment (id=26031)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26031)
propose fix for a couple possible async listener problems
I asked about these on the dev list and am proposing some simple fixes in case
there's agreement that they are bugs.
1. AsyncListeners are subject to resource injection from annotations, so they
should be created using the instance manager. To get the instance manager to
the AyncContextImpl I added a getInstanceManager() method to the Context
interface. Maybe there's a better way, this interface is currently not very
small or simple.
2. various application code can use one of the ServletContext.addListener
methods to tell the container to scan for annotations. Just because tomcat
doesn't yet actually scan doesn't mean it should throw an exception if you try
this.
cf servlet 3.0 spec section 15.5 page 179.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49937] Problems with AsyncListener and resource
injection
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49937
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version| |All
--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-10-03 16:40:20 EDT ---
The second point is not correct. The Javadoc (which annoyingly is considered
part of the specification even though it isn't in the specification document)
lists the valid listener classes and AsyncListener is not one of them. The spec
requires throwing an Exception in that case.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49937] Problems with AsyncListener and resource
injection
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49937
--- Comment #3 from david jencks <dj...@apache.org> 2010-10-03 17:00:02 EDT ---
Thanks for fixing the listener creation to use instance manager. As to whether
you can call addListener with an async listener, I don't think its very clear.
In Section 15.5: AsyncListener is included in the list of interfaces for which
<<
Annotations must be supported on the following container managed classes that
implement the following interfaces and are declared in the web application
deployment descriptor or using the annotations defined in Section 8.1,
“Annotations and pluggability” on page 8-61 or added programmatically.
>>
Note that this indicates that AsyncListeners can be annotated with @WebListener
and that the ServletContext.addListener methods can be called for an
AsyncListener.
Furthermore the section makes clear that resource injection must be supported
for AsyncListeners defined in web.xml, with a @WebListener annotation, or added
programatically, and that AsyncListeners can be managed beans.
Section 4.4.3 agrees with the javadoc you cite.
I think the spec contradicts itself here. I plan to ask for clarification from
the e.g. by filing a tck challenge.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
DO NOT REPLY [Bug 49937] Problems with AsyncListener and resource
injection
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49937
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-10-03 16:54:52 EDT ---
Fixed with an alternative patch in trunk and will be included in 7.0.4 onwards.
I used the same approach as is used in ApplicationFilterConfig to access the
InstanceManager.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org