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 | Description |
---|---|
ServerContext(org.cometd.bayeux.server.ServerSession session,
org.cometd.bayeux.server.ServerMessage message) |
Modifier and Type | Method | Description |
---|---|---|
org.cometd.bayeux.server.ServerMessage |
getServerMessage() |
|
org.cometd.bayeux.server.ServerSession |
getServerSession() |
Copyright © 2008–2017 The CometD Project. All rights reserved.