No, it scans via ASM for security reasons and only loads classes (with
no initialization) once you ask for classes that have a specific
annotation.
Sample code:
ClassFinder finder = new ClassFinder(webapp.getClassLoader(),
webappLibUrls);
for (Class<?> servlet : finder.findAnnotatedClasses(Servlet.class)) {
// .. do your processing
}
for (Class<?> filter : finder.findAnnotatedClasses(Filter.class)) {
// .. do your processing
}
// and so on
Additions are welcome if there are any features you might need.
-David
On Aug 4, 2009, at 1:18 PM, Filip Hanik - Dev Lists wrote:
does it load all the classes?
I think byte code check might make more sense if that is the case
Filip
On 08/04/2009 01:50 PM, David Jencks wrote:
We use xbean-finder for this in geronimo/openejb/etc.
http://repo2.maven.org/maven2/org/apache/xbean/xbean-finder/3.5/
https://svn.apache.org/repos/asf/geronimo/xbean/trunk/xbean-finder
We also have a servlet 3.0 spec jar I've been trying to keep up to
date with the glassfish javadocs.
https://repository.apache.org/content/repositories/snapshots/org/apache/geronimo/specs/geronimo-servlet_3.0_spec/1.0-EA-SNAPSHOT/
https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-servlet_3.0_spec
thanks
david jencks
On Aug 4, 2009, at 11:11 AM, Costin Manolache wrote:
Hi, anyone working on the @Filter, @Servlet annotation scanner for
tomcat-trunk ?
If I'm understanding it correctly, tomcat will have to read all
files in
classes and lib and look for the
annotation - and I would guess the only reasonable option is
looking at
bytecode.
I checked BCEL - seems reasonably easy, but if anyone has
different code - I
would rather reuse it in
tomcat-lite :-)
BTW - there is a typo in javax.servlet.ServletRegistration -
should be
Dynamic, not Dynmaic.
I can fix it next time I get some free time...
Costin
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]