That doesn't seem to help. Here's the code from DbStarter:
// This will get the setting from a context-param in
web.xml if defined:
ServletContext servletContext =
servletContextEvent.getServletContext();
String url = getParameter(servletContext, "db.url",
"jdbc:h2:~/test");
String user = getParameter(servletContext, "db.user", "sa");
String password = getParameter(servletContext, "db.password", "sa");
conn = DriverManager.getConnection(url, user, password);
servletContext.setAttribute("connection", conn);
2009/8/20 marius d. <[email protected]>
>
> Ok ...
>
> HTTPContext now has:
>
> def initParam(name: String): Box[String]
>
> def initParams: List[(String, String)]
>
>
> HTTPRequest has
>
> def context: HTTPContext
>
> LiftRules has (this was supported since a while. Sonow in boot you
> have access to HTTPContext and init parameters.)
>
> def context: HTTPContext
>
>
> Br's,
> Marius
>
> On Aug 20, 8:53 am, Naftoli Gugenheim <[email protected]> wrote:
> > H2's DbStarter reads the url/username/password and stores a connection
> > object back in the servlet context.
> >
> > -------------------------------------
> >
> > marius d.<[email protected]> wrote:
> >
> > I think that regardless of Naftoli's particular case he brought up a
> > valid point such as if when initializing a servlet user has a
> > ServletConfig ... we could easily abstract things here as well to make
> > it available in Boot as well. I'll noodle on this and see what I can
> > do.
> >
> > Of course I would not recommend using web.xml init params (unless
> > there are really compelling reasons to do so) but rather a Lift config
> > or an application config ... but that's just me.
> >
> > Br's,
> > Marius
> >
> > On Aug 20, 1:15 am, David Pollak <[email protected]>
> > wrote:
> >
> > > On Wed, Aug 19, 2009 at 11:29 AM, Naftoli Gugenheim
> > > <[email protected]>wrote:
> >
> > > > How can I read a context param (e.g. H2 sets "connection" param)?
> >
> > > Why is the context necessary to figure out the DB connection parameter?
> >
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Git some:http://github.com/dpp
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---