RestContinuation.async breaks LiftRules.responseTransformers?

15 views
Skip to first unread message

ti com

unread,
Oct 27, 2017, 2:10:48 PM10/27/17
to liftweb
I was running into an issue. To test, I have the following response transformer:
LiftRules.responseTransformers.append { liftResponse =>
println("\n\nliftResponse " + S.uri + ": " + liftResponse + "\n\n")
liftResponse
}
When my LiftRules.dispath DispatchPF is defined like this (run implementation elided):
def apply(req: Req) = () => {
def run: Future[LiftResponse] = ???
Full(Await.result(run, Duration.Inf))
}
Then my response transformer runs even on requests handled by the DispatchPF. However if I change it to this:
def apply(req: Req) = () => {
def run: Future[LiftResponse] = ???
val f = LiftRules.getLiftSession(req).buildDeferredFunction(() => run)
RestContinuation.async { k =>
f().onComplete {
case Success(liftResponse) => k(liftResponse)
case Failure(e) =>
e.printStackTrace()
k(InternalServerErrorResponse())
}
}
}
Then even though the pages are served properly, the response transformer doesn't run on those requests.
Is this by design, a bug, or am I doing something wrong somewhere?

Thanks.

Matt Farmer

unread,
Oct 28, 2017, 4:33:33 PM10/28/17
to lif...@googlegroups.com
I think this is a bug. The method handleGenericContinuation doesn't seem to invoke response transformers. It does invoke beforeSend and afterSend, but not response transformers.

Can you please file a bug in GitHub?

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages