scala/lift/Boot.scala
author Tomas Zeman <tzeman@volny.cz>
Fri, 22 Oct 2010 13:55:59 +0200
changeset 5 824fbbce8e65
child 7 186c5b1022aa
permissions -rw-r--r--
scala/lift/Boot.scala: useful rules (utf8, end/ fix)

/* 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)
                                    }

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

  }
}

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