Hi Frank,
This is very cool!
I verified that only the classes that are matched are actually loaded :-)
We only require that root resource classes are picked up (ones with a
UriTemplate on the class) so we don't actually need to scan the methods,
but we should scan for root resource classes that are static inner
classes (i am not even sure if the Jersey APT processor does that).
What do people think about replacing the APT processing and generating a
ResourceConfig impl with this functionality?
Would could implement this in the ServletAdaptor and for the Container
API. It might be appropriate to allow for an optional parameter that
specifies the set of packages to search under.
I am leaning towards this approach as it greatly simplifies the tooling
and deployment steps. I would also like to transition WADL over to be
generated dynamically (dependent on the resource model) and then we
require no tooling step what so ever.
Paul.
Frank Martínez wrote:
> Hi Paul,
>
>>> I have developed a Resource class scanner in my old project. It uses
>>> asm (bycode manipulation library) to scan WEB-INF/classes and
>>> WEB-INF/lib jars on a servlet init or a listener. The advantage of
>>> this approach is that resources are discovered at deployment time. Do
>>> you think it would be useful in jersey?
>>>
>> Definitely! I have wanted to look into this (see an email i sent to
>> the dev list talking about this). I think it has general
>> applicability for non-servlet deployments as well. It may mean we can
>> simplify the abstract resource model implementations. This is the
>> type of thing that WebBeans is doing, plus it means we can pick up
>> other components like EntityProviders using a WebBeans like technique
>> we have semi-specified.
>>
>
> Here is a proof of concept (attached)
> look at the Test class (It is not a JUnit test).
> The important method is ResourceClassScanner.scan( ... ).
>
> Important note: This implementation does not load not matching
> classes. It uses ASM (objectweb library) to parse .class files without
> loading it into the VM.
>
> Regards,
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109