From 6369a0b7ace031cad53fccbcd87b370d2fc24d7a Mon Sep 17 00:00:00 2001 From: Matt Farmer Date: Wed, 30 Aug 2017 21:39:55 -0400 Subject: [PATCH 1/2] Consider LiftRules.cometCreation while building comets This fixes a bug that appeared in Lift 3 where we stopped considering cometCreation while creating comets from creation info. --- .../src/main/scala/net/liftweb/http/LiftSession.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala index 88d87c350b..6943543a74 100644 --- a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala +++ b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala @@ -2487,8 +2487,9 @@ class LiftSession(private[http] val _contextPath: String, val underlyingId: Stri /** * As with `findOrBuildComet[T]`, but specify the type as a `String`. If the * comet doesn't already exist, the comet type is first looked up via - * `LiftRules.cometCreationFactory`, and then as a class name in the comet - * packages designated by `LiftRules.buildPackage("comet")`. + * `LiftRules.cometCreationFactory`, then `LiftRules.cometCreation`, and + * finally as a class name in the comet packages designated by + * `LiftRules.buildPackage("comet")`. */ private[http] def findOrCreateComet( cometType: String, @@ -2568,12 +2569,14 @@ class LiftSession(private[http] val _contextPath: String, val underlyingId: Stri } // Given a comet creation info, build a comet based on the comet type, first - // attempting to use LiftRules.cometCreationFactory and then building it by + // attempting to use `LiftRules.cometCreationFactory` and then attempting to + // find a match in `LiftRules.cometCreation`. Failing those, this will build it by // class name. Return a descriptive Failure if it's all gone sideways. // // Runs some base setup tasks before returning the comet. private def buildCometByCreationInfo(creationInfo: CometCreationInfo): Box[LiftCometActor] = { - LiftRules.cometCreationFactory.vend.apply(creationInfo) or { + LiftRules.cometCreationFactory.vend.apply(creationInfo) or + LiftRules.cometCreation.toList.find(_.isDefinedAt(creationInfo)).map(_.apply(creationInfo)) or { val cometType = findType[LiftCometActor]( creationInfo.cometType, From 734dba7f0c31103e12f568bfdd587f9b6e1f3275 Mon Sep 17 00:00:00 2001 From: Matt Farmer Date: Sun, 10 Sep 2017 20:52:33 -0400 Subject: [PATCH 2/2] Switch to using NamedPF.applyBox helper --- web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala index 6943543a74..f717ad5b75 100644 --- a/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala +++ b/web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala @@ -2576,7 +2576,7 @@ class LiftSession(private[http] val _contextPath: String, val underlyingId: Stri // Runs some base setup tasks before returning the comet. private def buildCometByCreationInfo(creationInfo: CometCreationInfo): Box[LiftCometActor] = { LiftRules.cometCreationFactory.vend.apply(creationInfo) or - LiftRules.cometCreation.toList.find(_.isDefinedAt(creationInfo)).map(_.apply(creationInfo)) or { + NamedPF.applyBox(creationInfo, LiftRules.cometCreation.toList) or { val cometType = findType[LiftCometActor]( creationInfo.cometType,