Permalink
Browse files

Woo Hoo... Java-based LiftActors work

  • Loading branch information...
1 parent 222f41a commit 4d5800575efc07a24a9803996acf079d426d04b8 @dpp dpp committed Feb 5, 2011
Showing with 36 additions and 0 deletions.
  1. +32 −0 liftj/src/main/java/code/comet/Yacker.java
  2. +4 −0 liftj/src/main/webapp/index.html
@@ -0,0 +1,32 @@
+package code.comet;
+
+import net.liftweb.util.*;
+import net.liftweb.http.*;
+import java.util.Date;
+
+public class Yacker extends JavaCometActor {
+ public void localSetup() {
+ ping();
+ super.localSetup();
+ }
+
+ private void ping() {
+ (new ScheduleJBridge()).schedule().perform(this,
+ new Pinger(),
+ 10000);
+ }
+
+ @Receive protected void ping(Pinger p) {
+ ping();
+ reRender();
+ }
+
+ public RenderOut render() {
+ return nsToNsFuncToRenderOut(Css.sel("#yack",
+ (new Date()).toString()));
+ }
+
+ class Pinger {
+ }
+}
+
@@ -11,6 +11,10 @@
<span class="lift:helloWorld.howdy">
Welcome to your Lift app at <span id="time">Time goes here</span>
</span>
+
+ <div class="lift:comet?type=Yacker">
+ The message is <span id="yack">Yack</span>
+ </div>
</p>
</div>
</body>

0 comments on commit 4d58005

Please sign in to comment.