Problems with JsCmds.RedirectTo + StreamingResponse on chrome

38 views
Skip to first unread message

Bruna Colnago

unread,
Jan 31, 2011, 9:22:09 AM1/31/11
to Lift
I'm trying to download a txt file with an ajaxBoutton using
JsCmds.RedirectTo.

bind("form","download" -> bDownload)

def bDownload:NodeSeq = ajaxButton("Download",downloadForm _)

private def downloadForm : JsCmd = {
JsCmds.RedirectTo("/result)
}

At my boot.scala I've add:

class Boot {
def boot {
LiftRules.dispatch.prepend {
case Req("result" :: _, _ , _) => () => {
val str="Hello world\n"
val headers:List[(String, String)] =
List(("ContentType","application/vnd.text"),
("Content-Length",str.length.toString),
("Content-Disposition","attachment;filename=\"hello.txt
\""))
val data = str.getBytes("UTF-8")
Full(StreamingResponse(new java.io.ByteArrayInputStream(data),
() => {},data.length, headers, Nil, 200))
}
}

It works fine on Firefox, but the file won't download on chrome.
Could anyone help'me finding where is the problem?

David Pollak

unread,
Jan 31, 2011, 9:52:07 PM1/31/11
to lif...@googlegroups.com

Please put together an example that demonstrates the issue Posting example code | Lift Space | Assembla
 

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




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics
Reply all
Reply to author
Forward
0 new messages