Class ServerAnnotationProcessor

java.lang.Object
org.cometd.annotation.ServerAnnotationProcessor

public class ServerAnnotationProcessor
extends Object

Processes annotations in server-side service objects.

Service objects must be annotated with Service at class level to be processed by this processor, for example:

 @Service
 public class MyService
 {
     @Session
     private ServerSession session;

     @Configure("/foo")
     public void configureFoo(ConfigurableServerChannel channel)
     {
         channel.setPersistent(...);
         channel.addListener(...);
         channel.addAuthorizer(...);
     }

     @Listener("/foo")
     public void handleFooMessages(ServerSession remote, ServerMessage.Mutable message)
     {
         // Do something
     }
 }
 

The processor is used in this way:

 BayeuxServer bayeux = ...;
 ServerAnnotationProcessor processor = ServerAnnotationProcessor.get(bayeux);
 MyService s = new MyService();
 processor.process(s);
 
See Also:
ClientAnnotationProcessor