Lift Framework 3.0-M3
Pre-release
Pre-release
This release brings quite a few changes, mostly as small improvements and bug fixes over M2. M3 is the next “stable snapshot” release, meaning that we've got some more big potentially-breaking changes in the pipeline and we're putting M3 out so that if you're on the SNAPSHOT build and those changes have negative effects, you can fall back on M3 and continue working.
Without further ado, here's a list of the changes that went in between M2 and M3 (note that they are not all super well-documented; more documentation will come before the 3.0 final release, but in the meantime please ask any questions you may have on the Lift mailing list):
Deprecations
- (#1668) Much of
TimeSpan's functionality has been deprecated.TimeSpanconflated several different concepts, includingDateTime,Duration, andPeriod, which did not have the same semantics. As a result, there were corner cases where it could behave in very unexpected ways. In order to fix this, we've deprecatedTimeSpanfunctionality for all uses that are not as a simple millisecondDuration. This deprecation takes effect for the final release of Lift 3.0, which means the functionality in question won't be removed until Lift 3.1 at the earliest. Big big thanks to @arkadius for spotting this issue while trying to clean up specs, and taking point on adding the various deprecations.
Improvements
- (#1619) Added a
MessageCometActorwhich is designed solely for pushing what were until now calledpartialUpdates. This is the beginning of a reworking of the comet API into a baseMessageCometActorthat handles just the messaging facet of comets, and aCometActorthat works like the current one does. In particular,MessageCometActordoes not have an overridablerendermethod, as it is not expected to render itself—only to push updates. If your comet actor usesrender, make sure that a call torendercan replace any previous rendering + any partial updates since then. That is to say, rendering at time t_0 and then sending partial updates at t_1, t_2, and t_3 should produce the same result as rendering at time t_4. This is because calling render clears the list of partial updates, so if that condition does not hold, you can lose information. In these cases, please render separately and useMessageCometActor. InMessageCometActor, you can and should usepushMessageinstead ofpartialUpdateto send a message to the client. We'll expand further on the distinction once we've fleshed out the APIs a bit more. - (#1619) Rename
devModeonCometActortoalwaysReRenderOnPageLoadto clarify what its purpose is. - (#1652) Lift now supports a
LiftRules.contentParsersrule that can be used to define parsers for templates, which the template loading pipeline can then use to load templates of various types. Out of the box, we provide the existing HTML and Markdown parsers, but this can easily be used to add, e.g., asciidoc support. The Scaladocs forLiftRules.contentParsersand theContentParserclass should provide a good guide to getting started, and an example of addingasciidocsupport can be seen in @joescii's blog source code. - (#1609) Using
toSingleBoxon aList[Box]that containsFailures now produces aParamFailurewhose chain is set up so that you can callfailureChainto get all of those failures. You can still use theParamFailures param to get the original list of boxes. - (#1663)
HLists are now covariant in their type parameters. Lift provides a lightweightHListinlift-util; this is a small improvement to it. More comprehensive (but also heavier and harder on the compiler)HLists are available using shapeless, as well. - (#1649) Session ids are no longer emitted into page markup.
- (#1650) The scaladocs in lift-common have seen a lot of general cleanup and improvement.
- (#1656, #1658) More reliable specs in a few corners of the framework, thanks to @arkadius.
Bug fixes
- (#1619) Lift 3.0 milestone builds until now had a few comet-related bugs. Amongst other things, they could unexpectedly lose partial updates and call render more than once when a page was initially rendered. Most of these issues should now be fixed.
- (#1619)
lastListenerTimeis now accurate, where before it was never updated. - (#1639) When throwing a
ResponseShortcutExceptionduring an AJAX request handler, we now correctly serve the specified response. Before, only those with a location attached were handled, by serving a JS redirect command. Now you can serve any response you want—though those that have a location associated will always result in a JS redirect command for now. - (#1640) The email regex in
ProtoRulesis now case insensitive and includes support for TLDs longer than 4 characters. - (#1646) Lift 3.0-M2 introduced the ability to serve new comet actors via AJAX; however, doing this from within an AJAX handler bound inside a comet, or using a
partialUpdate, had a few issues that prevented it from working correctly. These are now fixed. - (#1646)
S.appendJsfrom inside a comet's message handler could occasionally produce double execution of the JS, and other times could simply not work.S.appendJsshould now always work and correctly execute the JS only once when used from within a comet's message handler. - (#1648) Fix use of
S.oneShotandS.callOncewithajaxOnSubmit. - (#1664) The
LAFuturesingleton'scollectandcollectAllfunctions, when given an empty list, now return anLAFuturethat is immediately satisfied with an empty list. Before, these would return a future that would never be satisfied. Thanks to @arkadius.
Removals
- (#1619) Introduced in the first milestone of Lift 3.0,
CometActor'slastWhenDeltaPrunerhas been removed as it could present timing issues that were difficult to fix. It may make a reappearance before Lift 3 goes final, depending on whether we figure out how to implement it more robustly.