Skip to content

Instantly share code, notes, and snippets.

@OleTraveler
Created July 2, 2015 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OleTraveler/44215a835db015a3bcae to your computer and use it in GitHub Desktop.
Save OleTraveler/44215a835db015a3bcae to your computer and use it in GitHub Desktop.
Lift Boot Class
package bootstrap.liftweb {
import com.gaiam.gcsis._
import com.gaiam.gcsis.util.Logging
class Boot {
val log = Logging.logger(classOf[Boot])
def boot: Unit = {
log.debug("running Boot.boot")
// Package containing snippets for the application
LiftRules.addToPackages("com.gaiam.gcsi")
// Site Map Initialization
def sitemap() : SiteMap = {
log.debug(s"Initializing sitemap : ${Site.locs.mkString("(", ")\n(", ")")}")
SiteMap(Site.locs.reverse.map(Menu(_)): _*)
}
LiftRules.snippetDispatch.append {
case "OrderPlacement" => new com.gaiam.gcsi.snippet.OrderPlacement
}
ResourceServer.allow {
case "css" :: _ => true
}
//This is how we bypass Lift, these pages are served as regular HTML
LiftRules.liftRequest.append {
case Req("ember" :: _,_,_) => false
case Req("index" :: _,_,_) => false
case Req("codes" :: _,_,_) => false
case Req("sc" :: _,_,_) => false
case Req("nextbee" :: _,_,_) => false
case Req("angular" :: _,_,_) => false
case Req("index2" :: _,_,_) => false
case Req("neworder" :: _,_,_) => false
case Req("scc" :: _,_,_) => false
case Req("batch-shipments" :: _,_,_) => false
case Req("transaction-shipments" :: _,_,_) => false
case Req("product" :: _,_,_) => false
case Req("order-label" :: _,_,_) => false
}
/** Use the old lift render engine. */
LiftRules.htmlProperties.default.set((r: Req) => new
OldHtmlProperties(r.userAgent))
//Widget init
AutoComplete init
log.debug("Done running Boot.boot")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment