Please use the JsCommands.RedirectTo(...) method. This will send a JavaScript command to the browser that will cause it to redirect.
the S.redirectTo method is only for redirecting as part of a full page render. On Thu, Sep 24, 2009 at 1:49 PM, David <david.b...@gmail.com> wrote: > > Hello lifters, > I have the following form and bind: > SHtml.ajaxForm( > bind("ajax", xhtml, > "view" -> doView _, > "save" -> SHtml.ajaxButton( > "Save", > {() => > Log.info("Got a 'save' AJAX call") > this.redirectTo("/redirect1") //workflow/index2 > }, ("class", "ui-state-default ui-corner-all")))) > > When the 'Save' ajax button is called, the redirect should be invoked, > that is working. However I get the exception below. Based on what > I've read, this exception should be handled by lift. I don't have any > explicit exception handling in my code. > > Is there a bug here, is my redirect correct? I've also tried adding > this to my Boot.scala: > LiftRules.dispatch.prepend { > case Req("redirect1" :: _, _, _) => () => > Full(RedirectWithState("/workflow/index2", > RedirectState(() => println("Called on > redirect!"), > "My error" -> > NoticeType.Error))) > > > Thanks for any suggestions or help. > > -Dave > 16:44:14.097 [12569...@qtp-1983971-5] WARN lift.warn:114 - Request > for /ajax_request/F664660567847L4N/ failed Shortcut > net.liftweb.http.ResponseShortcutException: Shortcut > at net.liftweb.http.ResponseShortcutException$.redirect > (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.ResponseShortcutException$.redirect > (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala: > 77) [lift-webkit-1.1-SNAPSHOT.jar:na] > at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na] > at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151) > [classes/:na] > at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149) > [classes/:na] > at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] > at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] > at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply > (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] > at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] > at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: > 338) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: > 327) [lift-webkit-1.1-SNAPSHOT.jar:na] > at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na] > at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$ > $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: > 172) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: > 172) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:904) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at > net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$ > $anonfun$apply$20.apply(S.scala:1044) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:841) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit > $1.apply(S.scala:1042) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala: > 1041) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$ > $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply > $26$$anonfun$apply$27.apply(S.scala:1061) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$ > $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply > $26.apply(S.scala:1060) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$ > $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25.apply(S.scala: > 1059) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$ > $anonfun$apply$23$$anonfun$apply$24.apply(S.scala:1058) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$ > $anonfun$apply$23.apply(S.scala:1057) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at > net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1.apply > (S.scala:1056) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$.net$liftweb$http$S$$_innerInit(S.scala:1055) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun > $apply$31$$anonfun$apply$32$$anonfun$apply$33.apply(S.scala:1084) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun > $apply$31$$anonfun$apply$32.apply(S.scala:1083) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:119) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30$$anonfun > $apply$31.apply(S.scala:1082) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$30.apply > (S.scala:1081) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$$anonfun$_init$1.apply(S.scala:1080) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.S$._init(S.scala:1079) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.S$.init(S.scala:775) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet.doService(LiftServlet.scala:171) > [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply > (LiftServlet.scala:75) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet$$anonfun$doIt$1$1.apply > (LiftServlet.scala:75) [lift-webkit-1.1-SNAPSHOT.jar:na] > at > net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241) > [lift-util-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.Helpers$.calcTime(Helpers.scala:29) [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.TimeHelpers$class.logTime(TimeHelpers.scala:250) > [lift-util-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.Helpers$.logTime(Helpers.scala:29) > [lift-util-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet.doIt$1(LiftServlet.scala:74) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftServlet.service(LiftServlet.scala:79) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply > (HTTPProvider.scala:54) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply > (HTTPProvider.scala:54) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.URLRewriter$.doWith(Req.scala:471) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.HTTPProvider$class.service > (HTTPProvider.scala:53) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftFilter.service(LiftServlet.scala:507) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.servlet.ServletFilterProvider > $class.protected$service(ServletFilterProvider.scala:41) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala: > 507) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun > $doFilter$1.apply(ServletFilterProvider.scala:41) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun > $doFilter$1.apply(ServletFilterProvider.scala:36) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at > net.liftweb.http.RequestVarHandler$$anonfun$apply$4$$anonfun$apply > $5$$anonfun$apply$6$$anonfun$apply$7.apply(Vars.scala:125) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at > net.liftweb.http.RequestVarHandler$$anonfun$apply$4$$anonfun$apply > $5$$anonfun$apply$6.apply(Vars.scala:124) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at > net.liftweb.http.RequestVarHandler$$anonfun$apply$4$$anonfun$apply > $5.apply(Vars.scala:123) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.RequestVarHandler$$anonfun$apply$4.apply > (Vars.scala:122) [lift-webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) > [lift- > util-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:121) [lift- > webkit-1.1-SNAPSHOT.jar:na] > at net.liftweb.http.provider.servlet.ServletFilterProvider > $class.doFilter(ServletFilterProvider.scala:35) [lift-webkit-1.1- > SNAPSHOT.jar:na] > at net.liftweb.http.LiftFilter.doFilter(LiftServlet.scala:507) > [lift- > webkit-1.1-SNAPSHOT.jar:na] > at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter > (ServletHandler.java:1157) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.servlet.ServletHandler.handle > (ServletHandler.java:388) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.security.SecurityHandler.handle > (SecurityHandler.java:216) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.servlet.SessionHandler.handle > (SessionHandler.java:182) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.handler.ContextHandler.handle > (ContextHandler.java:765) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java: > 418) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.handler.ContextHandlerCollection.handle > (ContextHandlerCollection.java:230) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.handler.HandlerCollection.handle > (HandlerCollection.java:114) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.handler.HandlerWrapper.handle > (HandlerWrapper.java:152) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.Server.handle(Server.java:326) > [jetty-6.1.21.jar: > 6.1.21] > at > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java: > 536) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.HttpConnection$RequestHandler.content > (HttpConnection.java:930) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) > [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) > [jetty-6.1.21.jar:6.1.21] > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405) > [jetty-6.1.21.jar:6.1.21] > at org.mortbay.io.nio.SelectChannelEndPoint.run > (SelectChannelEndPoint.java:409) [jetty-6.1.21.jar:6.1.21] > at org.mortbay.thread.QueuedThreadPool$PoolThread.run > (QueuedThreadPool.java:582) [jetty-util-6.1.21.jar:6.1.21] > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---