Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Git Wiring and CometActors working together

  • Loading branch information...
commit ccb67097acd64f564b1ea51d29ae8bb8ab4d97f1 1 parent 49476cc
@dpp dpp authored
View
22 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Tail.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2010 WorldWide Conferencing, LLC
+ * Copyright 2009-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,23 +14,25 @@
* limitations under the License.
*/
-package net.liftweb {
-package builtin {
-package snippet {
+package net.liftweb
+package builtin
+package snippet
-import _root_.scala.xml._
-import _root_.net.liftweb.http._
+import scala.xml._
+import net.liftweb.http._
object Tail extends DispatchSnippet {
-
def dispatch: DispatchIt = {
case _ => render _
}
def render(xhtml: NodeSeq) : NodeSeq = <tail>{xhtml}</tail>
-
}
-}
-}
+object Head extends DispatchSnippet {
+ def dispatch: DispatchIt = {
+ case _ => render _
+ }
+
+ def render(xhtml: NodeSeq) : NodeSeq = <head>{xhtml}</head>
}
View
16 web/webkit/src/main/scala/net/liftweb/http/CometActor.scala
@@ -763,7 +763,7 @@ trait CometActor extends LiftActor with LiftCometActor with BindHelpers {
theSession.removeCometActor(this)
_localShutdown()
- case PartialUpdateMsg(cmdF) =>
+ case PartialUpdateMsg(cmdF) => {
val cmd: JsCmd = cmdF.apply
val time = Helpers.nextNum
val delta = JsDelta(time, cmd)
@@ -772,13 +772,19 @@ trait CometActor extends LiftActor with LiftCometActor with BindHelpers {
val m = millis
deltas = (delta :: deltas).filter(d => (m - d.timestamp) < 120000L)
if (!listeners.isEmpty) {
- val rendered = AnswerRender(new XmlOrJsCmd(spanId, Empty, Empty,
- Full(cmd), Empty, buildSpan, false, notices toList),
- whosAsking openOr this, time, false)
+ val rendered =
+ AnswerRender(new XmlOrJsCmd(spanId, Empty, Empty,
+ Full(cmd &
+ theSession.
+ postPageJavaScript()),
+ Empty, buildSpan, false,
+ notices toList),
+ whosAsking openOr this, time, false)
clearNotices
listeners.foreach(_._2(rendered))
listeners = Nil
}
+ }
}
@@ -980,7 +986,7 @@ trait CometActor extends LiftActor with LiftCometActor with BindHelpers {
}
}, Empty, false)
- protected implicit def jsToXmlOrJsCmd(in: JsCmd): RenderOut = new RenderOut(Empty, Empty, if (autoIncludeJsonCode) Full(in & jsonToIncludeInCode & S.jsToAppend()) else Full(in & S.jsToAppend()), Empty, false)
+ protected implicit def jsToXmlOrJsCmd(in: JsCmd): RenderOut = new RenderOut(Empty, fixedRender, if (autoIncludeJsonCode) Full(in & jsonToIncludeInCode & S.jsToAppend()) else Full(in & S.jsToAppend()), Empty, false)
implicit def pairToPair(in: (String, Any)): (String, NodeSeq) = (in._1, Text(in._2 match {case null => "null" case s => s.toString}))
View
2  web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
@@ -578,6 +578,8 @@ trait LiftRules extends Factory with FormVendor with LazyLoggable {
"testcond" -> TestCond,
"embed" -> Embed,
"tail" -> Tail,
+ "head" -> Head,
+ "Head" -> Head,
"with-param" -> WithParam,
"withparam" -> WithParam,
"WithParam" -> WithParam,
View
3  web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
@@ -815,8 +815,6 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
// The page or cometactor that the functions are associated with
val rv: String = RenderVersion.get
- println("In postpage... comet is "+S.currentCometActor)
-
val old = postPageFunctions.getOrElse(rv,
PostPageFunctions(rv,
0,
@@ -827,6 +825,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
old.functionCount + 1,
Helpers.millis,
func :: old.functions)
+
postPageFunctions += (rv -> updated)
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.