Class ServerAnnotationProcessor

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

public class ServerAnnotationProcessor extends AnnotationProcessor

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 = new ServerAnnotationProcessor(bayeux);
 MyService s = new MyService();
 processor.process(s);