How do I convert an Elem (with lift:surround) to a LiftResponse?
I find myself needing to produce a LiftResponse, and I have an existing piece of code that produces a Elem, inside of which is
stuffHow do I tu开发者_Go百科rn this into a LiftResponse? (I'm using Lift 2.2M1.)
Via the mailing list, David Pollak suggests
val r: Req = ...
val myResponse: Box[LiftResponse] =
for {
session <- S.session
template = TemplateFinder.findAnyTemplate("my_templates" :: "my_template" :: Nil)
response <- session.processTemplate(template, r, r.path, 200)
} yield response
although that thread also tries to explain why what I was trying to do was a bit strange in the first place.
精彩评论