Class OortService.ServerContext

  • Enclosing class:
    OortService<R,C>

    public static class OortService.ServerContext
    extends java.lang.Object

    Utility context that stores the ServerSession and the ServerMessage.

    CometD services that extend OortService may register themselves as listeners for messages sent by remote clients. In such case, this class will come handy in this way:

     @Service
     class MyService extends OortService<Boolean, ServerContext>
     {
         @Listener("/service/some")
         public void processSome(ServerSession remote, ServerMessage message)
         {
             String ownerOortURL = findOwnerOortURL();
             forward(ownerOortURL, "some", new ServerContext(remote, message));
         }
    
         protected Boolean onForward(Object forwardedData)
         {
             return "some".equals(forwardedData);
         }
    
         protected void onForwardSucceeded(Boolean result, ServerContext context)
         {
             context.getServerSession().deliver(getLocalSession(), "/service/some", result, null);
         }
    
         ...
     }
     
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerContext​(org.cometd.bayeux.server.ServerSession session, org.cometd.bayeux.server.ServerMessage message)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.cometd.bayeux.server.ServerMessage getServerMessage()  
      org.cometd.bayeux.server.ServerSession getServerSession()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServerContext

        public ServerContext​(org.cometd.bayeux.server.ServerSession session,
                             org.cometd.bayeux.server.ServerMessage message)
    • Method Detail

      • getServerSession

        public org.cometd.bayeux.server.ServerSession getServerSession()
      • getServerMessage

        public org.cometd.bayeux.server.ServerMessage getServerMessage()