Ah, yes!Sorry, I did not get the point, but obviously the val is to be
blamed ;-)
Now it's running, thanx!!!

Heiko

2009/8/5 marius d. <marius.dan...@gmail.com>

>
> I'm aware about the override thing but I don't see why you would do it
> in such way. Since you don't have state, you don't have a session =>
> you don't have S. Are you using a statelesDispatchPf ?
>
> You can do:
>
> 1. Use your own ResourceBundles
> 2. Or a hacky thingy like:
>
> val session = LiftRules.getLiftSession(request, httpRequest)
> S.initIfUninitted(session) {
>   // Now you should be able to call call S.?(...)
> }
>
> Localization is "bound" to state as ResourceBundles
>
> You exception thrown in Boot probably was cause because you used a val
> and it obviously tried to initialize it. Using a def or lazy val it
> would be evaluated properly upon requests.
>
> Typically S.? is used in the context of page rendering, Ajax functions
> processing, DispatchPF. All these are executed in a stateful context
> where S is available. To process pure stateless requests you have
> LiftRules.statelessDispatchTable, and a few request processing
> hooks ... but do you really need those?
>
> Do you have a usecase when you want to process a pure stateless
> requests and need Lift's localization?
>
> Br's,
> Marius
>
> On Aug 5, 8:50 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
> wrote:
> > def can be overridden with val. But this is a Scala thingy, please do not
> > bother. If it makes you easier replace val with def.
> > The question remains: How can i18n be done in "stateless" (request state)
> > cases?
> >
> > 2009/8/5 marius d. <marius.dan...@gmail.com>
> >
> >
> >
> >
> >
> > > I thought validations is a function not a val:
> >
> > > override val validations should probably be
> >
> > > override def validations ?
> >
> > > or
> >
> > > override lazy val validations ?
> >
> > > Br's,
> > > Marius
> >
> > > On Aug 5, 7:48 am, Heiko Seeberger <heiko.seeber...@googlemail.com>
> > > wrote:
> > > > I would like to internationalize my code. Something like:
> > > > Mapper class:
> >
> > > > class Course
> > > >   extends LongKeyedMapper[Course]
> > > >   with IdPK {
> >
> > > >   ...
> >
> > > >     override val validations =
> > > >       valMinLen(3, ?("minLen", 3)) _ ::
> > > >       valMaxLen(50, ?("maxLen", 50)) _ ::
> > > >       Nil
> > > >   }
> >
> > > > Localized messages:
> >
> > > > minLen=At least %s characters required!
> > > > maxLen=At most %s characters allowed!
> >
> > > > Thanx
> > > > Heiko
> >
> > > > 2009/8/4 marius d. <marius.dan...@gmail.com>
> >
> > > > > S lifetime is per request. S is not constructed on Boot. Could you
> > > > > post a code snippet on what you're trying to achieve?
> >
> > > > > Br's,
> > > > > Marius
> >
> > > > > On Aug 4, 12:43 pm, Heiko Seeberger <
> heiko.seeber...@googlemail.com>
> > > > > wrote:
> > > > > > Hi,
> >
> > > > > > When I try to use internationalization via S.? in a Mapper class,
> I
> > > get
> > > > > the
> > > > > > below exception while booting Lift. It seems that S._resBundle is
> > > null
> > > > > when
> > > > > > Schemifier tries to do its work.
> >
> > > > > > Is this a bug or a feature (S must not be used outside the
> request
> > > life
> > > > > > cycle). If last, how to i18n then?
> >
> > > > > > Thanx
> > > > > > Heiko
> >
> > > > > > 0 [main] ERROR lift - Failed to Boot
> > > > > > java.lang.ExceptionInInitializerError
> > > > > > at bootstrap.liftweb.Boot.boot(Boot.scala:38)
> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > > > at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > > > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > > > > at java.lang.reflect.Method.invoke(Method.java:585)
> > > > > > at
> >
> > >
> net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
> > > > > > at
> >
> > >
> net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
> > > > > > at
> >
> > >
> net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
> > > > > > at
> >
> > >
> net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
> > > > > > at net.liftweb.util.Full.map(Box.scala:330)
> > > > > > at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
> > > > > > at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
> > > > > > at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
> > > > > > at
> > > org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
> > > > > > at
> >
> > >
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> > > > > > at
> >
> > >
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
> > > > > > at
> org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> > > > > > at
> >
> > >
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
> > > > > > at
> >
> > >
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
> > > > > > at
> > > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
> > > > > > at
> >
> > >
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
> > > > > > at
> >
> > >
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> > > > > > at
> >
> > >
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> > > > > > at
> >
> > >
> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
> > > > > > at
> >
> > >
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> > > > > > at
> >
> > >
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> > > > > > at
> >
> > >
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> > > > > > at
> >
> > >
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> > > > > > at org.mortbay.jetty.Server.doStart(Server.java:222)
> > > > > > at
> >
> > >
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> > > > > > at
> >
> > >
> org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
> > > > > > at
> >
> > >
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
> > > > > > at
> >
> > >
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
> > > > > > at
> >
> > >
> org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
> > > > > > at
> > > org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
> > > > > > at
> >
> > >
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
> > > > > > at
> >
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
> > > > > > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
> > > > > > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
> > > > > > at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > > > at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > > > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > > > > at java.lang.reflect.Method.invoke(Method.java:585)
> > > > > > at
> > > org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> > > > > > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> > > > > > at
> > > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> > > > > > at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> > > > > > Caused by: java.lang.reflect.InvocationTargetException
> > > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > > > at
> >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > > > > at
> >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > > > > at java.lang.reflect.Method.invoke(Method.java:585)
> > > > > > at
> >
> > >
> net.liftweb.mapper.MetaMapper$$anonfun$27$$anonfun$apply$22.apply(MetaMapper.scala:869)
> > > > > > at
> >
> > >
> net.liftweb.mapper.MetaMapper$$anonfun$27$$anonfun$apply$22.apply(MetaMapper.scala:868)
> > > > > > at scala.Iterator$class.foreach(Iterator.scala:414)
> > > > > > at
> scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
> > > > > > at scala.Iterable$class.foreach(Iterable.scala:256)
> > > > > > at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
> > > > > > at
> > > net.liftweb.mapper.MetaMapper$$anonfun$27.apply(MetaMapper.scala:868)
> > > > > > at
> > > net.liftweb.mapper.MetaMapper$$anonfun$27.apply(MetaMapper.scala:859)
> > > > > > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
> > > > > > at net.liftweb.mapper.Safe$.runSafe(Safe.scala:44)
> > > > > > at net.liftweb.mapper.Mapper$class.runSafe(Mapper.scala:50)
> > > > > > at net.scalatraining.model.Course.runSafe(Course.scala:24)
> > > > > > at net.scalatraining.model.Course$.runSafe(Course.scala:50001)
> > > > > > at
> net.liftweb.mapper.MetaMapper$class.$init$(MetaMapper.scala:859)
> > > > > > at net.scalatraining.model.Course$.<init>(Course.scala:52)
> > > > > > at net.scalatraining.model.Course$.<clinit>(Course.scala:50003)
> > > > > > ... 53 more
> > > > > > Caused by: java.lang.NullPointerException
> > > > > > at net.liftweb.http.S$.$qmark$bang(S.scala:661)
> > > > > > at net.liftweb.http.S$.$qmark(S.scala:632)
> > > > > > at net.liftweb.http.S$.$qmark(S.scala:650)
> > > > > > at net.scalatraining.model.Course$title$.<init>(Course.scala:39)
> > > > > > at net.scalatraining.model.Course.title(Course.scala:30)
> > > > > > at net.scalatraining.model.Course$.title(Course.scala:50001)
> > > > > > ... 73 more
> >
> > > > > > --
> >
> > > > > > My blog: heikoseeberger.name
> > > > > > Follow me: twitter.com/hseeberger
> > > > > > OSGi on Scala:www.scalamodules.org
> > > > > > Lift, the simply functional web framework: liftweb.net
> >
> > > > --
> >
> > > > My blog: heikoseeberger.name
> > > > Follow me: twitter.com/hseeberger
> > > > OSGi on Scala:www.scalamodules.org
> > > > Lift, the simply functional web framework: liftweb.net
> >
> > --
> >
> > My blog: heikoseeberger.name
> > Follow me: twitter.com/hseeberger
> > OSGi on Scala:www.scalamodules.org
> > Lift, the simply functional web framework: liftweb.net
> >
>


-- 

My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: www.scalamodules.org
Lift, the simply functional web framework: liftweb.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to