Some tips to upgrade your lift 2.5 2.6 application to lift 3 (3.0-SNAPSHOT, 3.0-M2, ...etc)
replace ensureIndex(
by createIndex(
replace setIsUnset(
by setIfUnset(
for (sess <- S.session) {
val roundTrip = sess.buildRoundtrip(List[RoundTripInfo](
"loop" -> doLoop _,
"findUser" -> doFindUser _,
))}
object DelayedRest extends RestHelper {
serve {
case "delay" :: Nil Get _ =>
LAFuture(() => {
Thread.sleep(2000)
<b>Hello</b>})
}
}
updateListeners
to sendListenersMessage
JsonHandler
=> replaced with RoundTrips and SHtml.jsonCalljsonCall
=>jsonSend
- CometActor handleJson =>
receiveJson
remove EmbedMD and use template md from lift core support.
<div data-lift="embed?what=/docs/about-dev-text"></div>
No more get
, you can replace it by openOrThrowException("some msg")
val v = "user" -> u.asJValue ~
("whenCreated" -> "someDate"))
// { "user" { "some JValue Fields u.asJValue" , "whenCreated" : "someDate" }}
is now :
val v = "user" -> (u.asJValue ++
("whenCreated" -> "someDate")))
will produce an JArray
or for a JObject
val v = "user" -> (u.asJObject ++
("whenCreated" -> "someDate")))
where asJObject is :
import net.liftweb.common._
import net.liftweb.http._
import S._
import net.liftweb.json.JsonAST.JObject
import net.liftweb.json._
import net.liftweb.record.{MetaRecord, Record}
import net.liftweb.util._
import Helpers._
import scala.xml._
trait RecordExt[BaseRecord <: Record[BaseRecord]] extends Record[BaseRecord] {
self: BaseRecord =>
def meta: MetaRecord[BaseRecord] with MetaRecordExt[BaseRecord]
/** Encode a record instance into a JObject */
def asJObject(): JObject = {
meta.asJObject(this)
}
}
trait MetaRecordExt[BaseRecord <: Record[BaseRecord]] extends MetaRecord[BaseRecord] {
self: BaseRecord =>
/** Encode a record instance into a JObject */
def asJObject(rec: BaseRecord): JObject = {
JObject(fields(rec).map(f => JField(f.name, f.asJValue)))
}
}
Surround have a new attribute eat
to to drop the element that invoked the surround.
The at
attribute of surround is bind to element id. <lift:bind>
disappears.
Now include in lift core, no more sbt adds like lift-wizard. wizard html template integrate new lift 3 constraints, no more specific lift node. New example at : https://github.com/tuhlmann/lift-3-demo/blob/master/src/main/webapp/templates-hidden/wizard-all.html
mock Request replace mockReq.body = s by mockReq.body_(s)
JSONParser, Lift's legacy JSON parser, along with its dependents:
MetaRecord.setFieldsFromJSON
MetaRecord.fromJSON
CometActor's handleJson, jsonCall, and jsonInCode
S.buildJsonFunc
S.jsonFmapFunc with Any=>JsCmd
JsonHandler
SHtml.fjsonCall
SHtml.jsonButton with Any=>JsCmd
SHtml.jsonForm
Mapper and MetaMapper's snippet bindings that use PartialFunctions:
addSnippet, editSnippet, viewSnippet (in favor of addFormSnippet, editFormSnippet, andviewTransform, all based on CSS selector transforms)
modSnippet, used in addSnippet and editSnippet, superseded by formSnippet.
add, edit, and view snippets in HTML, in favor of addForm, editForm, and viewTransform
fieldMapperPF, in favor of fieldMapperTransforms
fieldPF, appendField, and prependField, in favor of fieldTransforms, appendFieldTransform, and prependFieldTransform.
- Lift Framework 3.0-M0
- Lift Framework 3.0-M2
- http://lift.la/blog/lift_30
- https://shadowfiend.svbtle.com/lift-monthly-recap-1
- https://shadowfiend.svbtle.com/lift-monthly-recap-2
- https://shadowfiend.svbtle.com/lift-weekly-recap-4
- https://shadowfiend.svbtle.com/lift-weekly-recap-5-comets-and-funcnames-oh-my
- https://shadowfiend.svbtle.com/lift-weekly-recap-6-speed-data-and-elementals
Ran across this via Google; nice recap!