diff options
Diffstat (limited to 'sca-java-2.x/contrib/samples/learning-more')
2 files changed, 6 insertions, 1 deletions
diff --git a/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatService.java b/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatService.java index 4c35e1c5e3..fbff379a52 100644 --- a/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatService.java +++ b/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatService.java @@ -2,14 +2,17 @@ package org.apache.tuscany.sca.sample.comet; import org.apache.tuscany.sca.binding.comet.runtime.callback.CometCallback; import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; import org.oasisopen.sca.annotation.Remotable; @Callback(CometCallback.class) @Remotable public interface ChatService { + @OneWay void register(); - + + @OneWay void postMessage(String user, String message); } diff --git a/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatServiceImpl.java b/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatServiceImpl.java index b58de00035..f54da62f90 100644 --- a/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatServiceImpl.java +++ b/sca-java-2.x/contrib/samples/learning-more/binding-comet/chat-webapp/src/main/java/org/apache/tuscany/sca/sample/comet/ChatServiceImpl.java @@ -31,6 +31,8 @@ public class ChatServiceImpl implements ChatService { @Override public void register() { + // saving the callback object during register() method so it will push data back to the client + // using the callback method defined for the register operation in the js when used clients.add(context.getRequestContext().<CometCallback> getCallback()); } } |