And the boot file looks like this:
package bootstrap.liftweb
import _root_.net.liftweb.util._
import _root_.net.liftweb.http._
import _root_.net.liftweb.sitemap._
import _root_.net.liftweb.sitemap.Loc._
import Helpers._
import _root_.net.liftweb.mapper.{DB, ConnectionManager, Schemifier,
DefaultConnectionIdentifier, ConnectionIdentifier}
import _root_.java.sql.{Connection, DriverManager}
import _root_.scalableKvidr.model._
import _root_.javax.servlet.http.{HttpServletRequest}
import net.liftweb.common._
/**
* A class that's instantiated early and run. It allows the
application
* to modify lift's environment
*/
class Boot {
def boot {
if (!DB.jndiJdbcConnAvailable_?)
DB.defineConnectionManager(DefaultConnectionIdentifier,
DBVendor)
// where to search snippet
LiftRules.addToPackages("scalableKvidr")
Schemifier.schemify(true, Log.infoF _, User, Tag, Tweet, TagUser)
// Build SiteMap
val entries = Menu(Loc("forside", List("index"), "Forside")) ::
Menu(Loc("Alle_Kategorier", List("allcategories"), "Alle
Kategorier")) ::
Menu(Loc("Brugere", List("bruger"), "Brugere")) ::
Menu(Loc("Tilmeld", List("tilmeld"), "Tilmeld")) ::
Menu(Loc("Hvad Er Kvidr?", List("hvad_er_kvidr"), "Hvad Er
Kvidr?")) ::
Menu(Loc("kategori", List("category"), "Kategori",
Hidden)) ::
Nil
LiftRules.setSiteMap(SiteMap(entries:_*))
// Rewrite rules, rules! ;)
LiftRules.rewrite.append {
case RewriteRequest(
ParsePath(List("kategori",tag),_,_,_),_,_) =>
RewriteResponse("category" :: Nil, Map("tag" -> tag))
/*case RewriteRequest(
ParsePath(List("kategori","alle"),_,_,_),_,_) =>
RewriteResponse("allcategories" :: Nil)*/
}
/*
* Show the spinny image when an Ajax call starts
*/
LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
/*
* Make the spinny image go away when it ends
*/
LiftRules.ajaxEnd =
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
LiftRules.early.append(makeUtf8)
S.addAround(DB.buildLoanWrapper)
}
/**
* Force the request to be UTF-8
*/
private def makeUtf8(req: HttpServletRequest) {
req.setCharacterEncoding("UTF-8")
}
}
object DBVendor extends ConnectionManager {
def newConnection(name : ConnectionIdentifier) = {
try {
Class.forName("com.mysql.jdbc.Driver")
val dm = DriverManager.getConnection("jdbc:mysql://localhost:8889/
databaseinformationhere)
Full(dm)
} catch {
case e : Exception => e.printStackTrace; Empty
}
}
def releaseConnection(conn: Connection) {conn.close}
}
On Jan 6, 1:17 pm, Mads Hartmann <[email protected]> wrote:
> Aha! It almost compiles now. There's just one last error:
>
> [INFO] Compiling 8 source files to /Users/Mads/Projects/scalableKvidr2/
> target/classes at 1262780161026
> [ERROR] /Users/Mads/Projects/scalableKvidr2/src/main/scala/bootstrap/
> liftweb/Boot.scala:61: error: type mismatch;
> [INFO] found : (javax.servlet.http.HttpServletRequest) => Unit
> [INFO] required: (net.liftweb.http.provider.HTTPRequest) => Any
> [INFO] LiftRules.early.append(makeUtf8)
> [INFO] ^
> [ERROR] one error found
>
> On Jan 6, 12:59 pm, Jeppe Nejsum Madsen <[email protected]> wrote:
>
>
>
> > Mads Hartmann <[email protected]> writes:
> > > Again, I really appreciate you guys helping me out :)
>
> > > @Indrajit I just tried with the dependency you declared as the only
> > > lift related dependency. I get the following error.
>
> > > <dependency>
> > > <groupId>net.liftweb</groupId>
> > > <artifactId>lift-mapper</artifactId>
> > > <version>1.1-M8</version>
> > > </dependency>
>
> > Note, Lift 1.1 is not source compatible with 1.0. You need to change
> > your code (in a few places) Specifically, it seems you need to add
>
> > import net.liftweb.common._
>
> > to Boot.scala
>
> > /Jeppe
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.