Giter Site home page Giter Site logo

liftbook's Introduction

Book for the Lift Web Framework

Derek, Marius and I, with the help of the community, will be putting together a comprehensive book for using Lift.

We have set up a Google Group for topic discussion here: http://groups.google.com/group/the-lift-book

The work will be licensed under the Creative Commons "Attribution-No Derivatives" found here: http://creativecommons.org/license/results-one?license_code=by-nd This work is licensed under the Creative Commons Attribution-No Derivative Works 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

liftbook's People

Contributors

dchenbecker avatar dpp avatar tjweir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liftbook's Issues

Unclear that we shouldn't be developing alongside PocketChange

I'm trying to wrap my head around Lift, so I began reading the book. First off, way to go. This is the only complete and accessible lift introduction that I've found on the internet.

However, I found myself lost during the Pocket Change chapter (Chapter 2). I was trying to develop alongside the example, which was a failing proposition because a fair amount of code necessary to make the project compile was not there! For example, the code for the Account model object references these symbols AccountAdmin and AccountViewer which are never implemented, brought up again, or explained during the entire rest of the book.

Only by looking at the git source was I able to make the model compile and continue to code alongside the tutorial.

Calculating Locale Based on Cookies invalid characters (fix code)

In http://exploring.liftweb.net/master/index-D.html in the end of file part "Calculating Locale Based on Cookies and Parameters" code

wrong code character : replace ’-’, ’’ with ’-’, ’’ and remove invisible illegal characters. fixed code:


// Properly convert a language tag to a Locale
def computeLocale(tag : String) = tag.split(Array(’-’, ’_’)) match {
  case Array(lang) => new Locale(lang)
  case Array(lang, country) => new Locale(lang, country)
  case Array(lang, country, variant) => new Locale(lang, country, variant)
}

// Define this to be whatever name you want
val LOCALE_COOKIE_NAME = "SelectedLocale"

LiftRules.localeCalculator = {
  case fullReq @ Full(req) => {
    // Check against a set cookie, or the locale sent in the request
    def currentLocale : Locale =
      S.findCookie(LOCALE_COOKIE_NAME).flatMap {
        cookie => cookie.value.map(computeLocale)
      } openOr LiftRules.defaultLocaleCalculator(fullReq)

    // Check to see if the user explicitly requests a new locale
    S.param("locale") match {
      case Full(requestedLocale) if requestedLocale != null => {
        val computedLocale = computeLocale(requestedLocale)
        S.addCookie(HTTPCookie(LOCALE_COOKIE_NAME, requestedLocale))
        computedLocale
      }
      case _ => currentLocale
    }
  }
  case _ => Locale.getDefault
}


Listing 3.6: A Complex Rewrite Example

In Listing 3.6, A Complex Rewrite Example:

val rewriter : PartialFunction[RewriteRequest,RewriteResponse] = {
  case RewriteRequest(ParsePath(username :: Nil, _, _, _),
      DeleteRequest,
      httpreq)
      if isMgmtSubnet(httpreq.getRemoteHost()) =>
    RewriteResponse(deleteUser :: Nil, Map(username -> username))
}
LiftRules.rewrite.append(rewriter)

Should probably be:

val rewriter : PartialFunction[RewriteRequest,RewriteResponse] = {
  case RewriteRequest(ParsePath("username" :: Nil, _, _, _),
      DeleteRequest,
      httpreq)
      if isMgmtSubnet(httpreq.getRemoteHost()) =>
    RewriteResponse("deleteUser" :: Nil, Map("username" -> username))
}
LiftRules.rewrite.append(rewriter)

Section 1.1 : Typo

For those of you have experience

should be

For those of you who have experience

Coverage of AjaxForm

In chapter 9, there is some explanations and examples for individual ajax components but it would be really helpful if there was some explanation and an example with template and snippet using an AjaxForm - something similar to what is at the beginning of chapter 4 for regular forms.

Listing 2.2 Pocket Change Account Entity. Error in import of Empty

When using Lift v2.3 with Scala 2.8.1, the class Empty is declared in net.liftweb.common package and available in lift-common_2.8.1-2.3. In Listing 2.2 the third import should be import _root_.net.liftweb.common.Empty instead of import _root_.net.liftweb.util.Empty

Misprints in 13.5

In

"It is developer by Jabber [E]  [E] http://xmpp.org/about/jabber.shtml open-source community. Lift provides an XMPP dispatcher implementation that you application can use to receive instant messages, manage rosters etc."

looks like "developer" should be "developed" and "you application" should be "your application".

issues starting up PocketChange app in Tomcat

Hello:
I'm trying to start up PocketChange in Tomcat (version 6.0.24). I downloaded the version from http://github.com/tjweir/pocketchangeapp/tree on Feb 01, 2010.

When I try starting up using "mvn jetty:run" it's all fine. But when I deploy the WAR using Tomcat. I get the following error upon starting. The "SEVERE" debug statements repeat forever. Please advise on how I can use Tomcat for my development instead of Jetty.

PS: The other problem with this behavior is that eventually it starts throwing "Out-of-memory" errors and the whole JVM comes to a slow death.


Feb 1, 2010 1:20:34 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Feb 1, 2010 1:20:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 405 ms
Feb 1, 2010 1:20:34 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 1, 2010 1:20:34 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
INFO - CREATE TABLE users (firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw
VARCHAR(48) , password_slt VARCHAR(20) , validated BOOLEAN , superuser BOOLEAN , uniqueid VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE tag (account BIGINT , name VARCHAR(64) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE account (externalaccount VARCHAR(300) , balance DECIMAL(16,2) , is_public BOOLEAN , name VARCHAR(100) , id BIGINT NOT NULL AUTO_IN
CREMENT , description VARCHAR(300) , owner BIGINT)
INFO - CREATE TABLE accountadmin (administrator BIGINT , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE accountviewer (viewer BIGINT , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE accountnote (note LONGVARCHAR , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE expense (dateof TIMESTAMP , amount DECIMAL(16,2) , description VARCHAR(100) , notes VARCHAR(1000) , account BIGINT , serialnumber
BIGINT , currentbalance DECIMAL(16,2) , receiptmime VARCHAR(100) , receipt BINARY , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE expensetag (expense BIGINT , id BIGINT NOT NULL AUTO_INCREMENT , tag BIGINT)
INFO - CREATE INDEX users_email ON users ( email )
INFO - CREATE INDEX users_uniqueid ON users ( uniqueid )
INFO - CREATE INDEX users_id ON users ( id )
INFO - CREATE INDEX tag_account ON tag ( account )
INFO - CREATE INDEX tag_id ON tag ( id )
INFO - CREATE INDEX account_id ON account ( id )
INFO - CREATE INDEX account_owner ON account ( owner )
INFO - CREATE INDEX accountadmin_administrator ON accountadmin ( administrator )
INFO - CREATE INDEX accountadmin_account ON accountadmin ( account )
INFO - CREATE INDEX accountadmin_id ON accountadmin ( id )
INFO - CREATE INDEX accountviewer_viewer ON accountviewer ( viewer )
INFO - CREATE INDEX accountviewer_account ON accountviewer ( account )
INFO - CREATE INDEX accountviewer_id ON accountviewer ( id )
INFO - CREATE INDEX accountnote_account ON accountnote ( account )
INFO - CREATE INDEX accountnote_id ON accountnote ( id )
INFO - CREATE INDEX expense_account ON expense ( account )
INFO - CREATE INDEX expense_id ON expense ( id )
INFO - CREATE INDEX expensetag_expense ON expensetag ( expense )
INFO - CREATE INDEX expensetag_id ON expensetag ( id )
INFO - CREATE INDEX expensetag_tag ON expensetag ( tag )
INFO - Bootstrap up
Feb 1, 2010 1:20:39 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
Feb 1, 2010 1:20:39 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 1, 2010 1:20:39 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Feb 1, 2010 1:20:39 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5400 ms
Feb 1, 2010 1:20:49 PM org.apache.catalina.loader.WebappClassLoader modified
INFO: Additional JARs have been added : 'mail-1.4.jar'
Feb 1, 2010 1:20:49 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 1, 2010 1:20:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Feb 1, 2010 1:20:49 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Thread-12] but has failed to stop it. This is very likely to create a memory leak.
Feb 1, 2010 1:20:49 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@c70b0d]) and a value of type [net.liftweb.util.Full](value [Full%28java.util.PropertyResourceBundle@1a6a1a7%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
Feb 1, 2010 1:20:49 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@bef361]) and a value of type [scala.collection.mutable.HashMap](value [Map%28%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
INFO - Bootstrap up
Feb 1, 2010 1:21:01 PM org.apache.catalina.loader.WebappClassLoader modified
INFO: Additional JARs have been added : 'mail-1.4.jar'
Feb 1, 2010 1:21:01 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 1, 2010 1:21:01 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Feb 1, 2010 1:21:01 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Thread-22] but has failed to stop it. This is very likely to create a memory leak.
Feb 1, 2010 1:21:01 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@51e67c]) and a value of type [net.liftweb.util.Full](value [Full%28java.util.PropertyResourceBundle@f2da21%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
Feb 1, 2010 1:21:01 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@1cee361]) and a value of type [scala.collection.mutable.HashMap](value [Map%28%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
INFO - Bootstrap up
Feb 1, 2010 1:21:12 PM org.apache.catalina.loader.WebappClassLoader modified
INFO: Additional JARs have been added : 'mail-1.4.jar'
Feb 1, 2010 1:21:12 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Feb 1, 2010 1:21:12 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [org.h2.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Feb 1, 2010 1:21:12 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Thread-32] but has failed to stop it. This is very likely to create a memory leak.
Feb 1, 2010 1:21:12 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@99ff91]) and a value of type [net.liftweb.util.Full](value [Full%28java.util.PropertyResourceBundle@598d00%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
Feb 1, 2010 1:21:12 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@13816e0]) and a value of type [scala.collection.mutable.HashMap](value [Map%28%29]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.

INFO - Bootstrap up

Any advise?

Additional Data >>>>>>>>>>>>>>>

I also tried to create a H2 DB outside of PocketChange and point it to that by modifying the DriverManager.getConnection in Boot.scala
From:
val dm = DriverManager.getConnection("jdbc:h2:pca_example")
To:
val dm = DriverManager.getConnection("jdbc:h2:tcp://localhost:9092/C:/db/PocketChangeDB", "admin", "admin")

After deploying the new WAR it to Tomcat. Here's what I'm getting now. No more continuous repeating errors and no "out-of-memory" issues. But when I bring up the app. I see the following message on interface:

"No Navigation Defined." and there are no options available to do anything.


Feb 1, 2010 1:43:41 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Feb 1, 2010 1:43:41 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 447 ms
Feb 1, 2010 1:43:41 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 1, 2010 1:43:41 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
INFO - CREATE TABLE users (firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw
VARCHAR(48) , password_slt VARCHAR(20) , validated BOOLEAN , superuser BOOLEAN , uniqueid VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE tag (account BIGINT , name VARCHAR(64) , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE account (externalaccount VARCHAR(300) , balance DECIMAL(16,2) , is_public BOOLEAN , name VARCHAR(100) , id BIGINT NOT NULL AUTO_IN
CREMENT , description VARCHAR(300) , owner BIGINT)
INFO - CREATE TABLE accountadmin (administrator BIGINT , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE accountviewer (viewer BIGINT , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE accountnote (note LONGVARCHAR , account BIGINT , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE expense (dateof TIMESTAMP , amount DECIMAL(16,2) , description VARCHAR(100) , notes VARCHAR(1000) , account BIGINT , serialnumber
BIGINT , currentbalance DECIMAL(16,2) , receiptmime VARCHAR(100) , receipt BINARY , id BIGINT NOT NULL AUTO_INCREMENT)
INFO - CREATE TABLE expensetag (expense BIGINT , id BIGINT NOT NULL AUTO_INCREMENT , tag BIGINT)
ERROR - Failed to Boot
java.util.NoSuchElementException: key not found: users
at scala.collection.Map$class.default(Map.scala:169)
at scala.collection.mutable.HashMap.default(HashMap.scala:33)
at scala.collection.Map$class.apply(Map.scala:80)
at scala.collection.mutable.HashMap.apply(HashMap.scala:33)
at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply(Schemifier.scala:189)
at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply(Schemifier.scala:189)
at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using(Schemifier.scala:43)
at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala:189)
at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala:184)
at scala.List.flatMap(List.scala:1125)
at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$ensureColumns(Schemifier.scala:183)
at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply(Schemifier.scala:61)
at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply(Schemifier.scala:61)
at scala.List.foldLeft(List.scala:1059)
at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply(Schemifier.scala:61)
at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply(Schemifier.scala:54)
at net.liftweb.mapper.DB$.use(DB.scala:305)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36)
at bootstrap.liftweb.Boot.boot(Boot.scala:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:392)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:390)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:909)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:909)
at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:909)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:573)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:548)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Feb 1, 2010 1:43:46 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
Feb 1, 2010 1:43:46 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 1, 2010 1:43:46 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Feb 1, 2010 1:43:46 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 5437 ms

Add section on LiftSession

There is some really useful stuff in LiftSession (the onSessionX event callbacks for example) but there is little or documentation discussing the class, the callback lists, when they get called or appropriate strategies for how and when to use them. For example: what the heck does it mean to "passivate" a session?

SBT chapter

Are there any plans to describe how to use Lift with Simple Build Tool?

Broken link on footer

In page 11, link to wiki about David Pollak's view first pattern article is broken.

Add section on lift-json

A lot of cool stuff in there, need to revise the JavaScript chapter to match. Already covering a little in the REST chapter, but not enough.

Incorrect Description of MetaMapper.fieldOrder

Hi,
Not sure if you saw this thread in the Lift group recently, but I made the point that I noticed behaviour that contradicted what was described in Exploring Lift:

"If you don’t want a particular field to show up in forms or XHTML output, simply omit it from the fieldOrder↓ list." (http://exploring.liftweb.net/master/index-8.html#toc-Section-8.1)

DPP replied with:

"Actually, Exploring is wrong about this. The field order defines the order the fields will be displayed, but if a field is not listed in field order, it will be displayed in an undetermined order after the ordered fields have been displayed. This particular feature goes back to pre-Lift Mapper."

https://groups.google.com/d/msg/liftweb/i9KPOesBmpQ/nuWPMXA-nuMJ

Thanks

Damian.

Tweaks neeed in section 3.7

Per http://groups.google.com/group/the-lift-book/browse_thread/thread/da4d7c7cb6d79547?hl=en

  • The last sentence of the paragraph justifying the use of LiftView vs
    InsecureLiftView might be more explicit if it said "If a user attempts
    to go to /ExpenseView/doEnumerate they’ll get a 404 because
    doEnumerate is not defined in the dispatch method." As I understand it,
    InsecureLiftView would also return a 404 for a request to /ExpenseView/
    privateMethod, since the method does not exist. Alternatively, if
    privateMethod were included in Listing 3.9 and did something
    destructive, it might highlight the insecurity of InsecureLiftView.
  • The next paragraph (the last of 3.7) begins with "Another difference
    between custom dispatch and Views is that...". I don't know what
    custom dispatch is yet (as I've read that it's in section 7.2). At
    this point in my reading, this particular paragraph is a little
    confusing. Maybe it should be removed/reworked? Maybe it could give me
    a teaser of what custom dispatch is, to make me look forward to
    section 7.2?

Sample code of URL rewrite has compilation error.

In sec 3.7 code list 3.6, A Complex Rewrite Example, there is a val declaration,
val rewriter = {
case RewriteRequest(ParsePath(username :: Nil, _, _, _),
DeleteRequest,
httpreq)
if isMgmtSubnet(httpreq.getRemoteHost()) =>
RewriteResponse(deleteUser :: Nil, Map(username -> username))
}
The Scala compiler will compile the case statement to a Functionk or PartialFunction object, but if you don't specify the val type, there should be a compilation error. I think it should be,
val rewriter:PartialFunction[RewriteRequest,RewriteResponse] = {...}
My Scala version is 2.8.1.final.
This book is great, thanks for your work :-)
Thanks,
Kevin Xiao

Cover FactoryMaker and Inject

A discussion on Mailer brought this up. It would be nice to discuss how FactoryMaker and StackableMaker work since it's pervasive in LiftRules.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.