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