scala/lift/Boot.scala
author Tomas Zeman <tomas@functionals.cz>
Tue, 15 Dec 2020 09:22:21 +0100
changeset 60 4267602e8494
parent 7 186c5b1022aa
permissions -rw-r--r--
fs2json: directory structure -> json object converter. E.g. to be used instead of erica / py-Couchapp (interaction with couchdb is left to the user).

/* additions to Boot.scala */

class Boot extends Logger {

  def boot = {
    ...

    /* Handle end slash and drop it (except for home page) */
    LiftRules.statelessRewrite.append {
      case RewriteRequest(ParsePath(xs,_,_,true),_,_) if (xs.size > 1) &&
        (xs.lastOption == Some("index")) =>
          RewriteResponse(xs dropRight 1)
    }

    /* Date format */
    LiftRules.dateTimeConverter.default.set { () => YmdDateTimeConverter }

    /* Http conf */
    LiftRules.logServiceRequestTiming = false
    LiftRules.early.append(_.setCharacterEncoding("UTF-8"))

  }
}

// vim: set ts=2 sw=2 et: