dev@glassfish.java.net

Re: annotation scanning

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Thu, 29 Jul 2010 13:16:47 -0700

On 7/29/10 6:57 AM, Justin Lee wrote:
> What I was thinking (at least in my initial "what if?" thoughts) is
> that you'd have something like:
>
> @WebSocketApplication(uri="/bob")
> public class Bob { ... }
>
> and then at deploy time, the container would detect that annotation on
> the class and hand off the class ref to a handler in glassfish that
> would then register this class/uri combo with the WebSocketEngine.
> This would prevent developers from having to do sad hacks such as
> create a servlet whose sole job is to do that work in its init().
>
so yes it's possible. I don't even think u need a handler. your
container deployer could just look for all classes annotated with
WebSocket.class annotation and do what's necessary.

I am in the process of adding class-model from hk2 in the deployment
backend which will give you information like "give me all classes
annotated with an annotation of type WebSocket.class". It should be
ready within a week.

jerome
> On 7/29/10 9:54 AM, Jerome Dochez wrote:
>> On 7/29/10 6:38 AM, Justin Lee wrote:
>>> If i wanted to define an annotation so that people could just
>>> annotate their websocket application and have glassfish find and
>>> deal with that annotation, how would I go about that? Is that even
>>> possible? It'd obviously involve at least one new annotation and
>>> then a handler. Are we able to hook in to the system like that?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>> it is but I need to understand a few more things...
>>
>> 1. how would your annotation data be used ? meaning who is
>> responsible for handling the annotation contract at runtime ? Is it a
>> deployer ? or a container ?
>> 2. how would the annotation be used ? in a class ? method ? etc...
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>