Package org.cometd.oort
Class OortService.ServerContext
java.lang.Object
org.cometd.oort.OortService.ServerContext
- Enclosing class:
- OortService<R,C>
public static class OortService.ServerContext extends 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(ServerSession session, ServerMessage message)
-
Method Summary
Modifier and Type Method Description ServerMessage
getServerMessage()
ServerSession
getServerSession()