Permalink
Browse files

Do not run stateful rewrites in stateless mode

  • Loading branch information...
1 parent 3000f8c commit 4f4b10a4044f9736d338cef27eb82e8b9a5617d6 @dpp dpp committed Mar 17, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -1490,6 +1490,14 @@ for {
*/
def addCleanupFunc(f: () => Unit): Unit = postFuncs.is += f
+ /**
+ * Are we currently in the scope of a stateful request
+ */
+ def statefulRequest_? : Boolean = session match {
+ case Full(s) => s.stateful_?
+ case _ => false
+ }
+
private def _nest2InnerInit[B](f: () => B): B = {
_functionMap.doWith(new HashMap[String, AFuncHolder]) {
doAround(aroundRequest) {
@@ -1516,8 +1524,11 @@ for {
private def doStatefulRewrite(old: Req): Req = {
// Don't even try to rewrite Req.nil
- if (!old.path.partPath.isEmpty && (old.request ne null))
- Req(old, S.sessionRewriter.map(_.rewrite) ::: LiftRules.statefulRewrite.toList, LiftRules.statelessTest.toList)
+ if (statefulRequest_? &&
+ !old.path.partPath.isEmpty &&
+ (old.request ne null))
+ Req(old, S.sessionRewriter.map(_.rewrite) :::
+ LiftRules.statefulRewrite.toList, LiftRules.statelessTest.toList)
else old
}

0 comments on commit 4f4b10a

Please sign in to comment.