[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Tim Perrett
Alli, Mark is correct - I'd create a LiftResponse sublass and handle that request with a DispatchPF. If your not familiar, check out prependDispatch in Boot.scala of the demo site. If you can supply a bit more information about what exacty you want to do (I'm guessing you want to force downlod

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Marius
If your using SHtml.fileUpload after you process your file you can send a redirect back by calling S.redirectTo ... towards a path where you just download your processed file. Note that from your upload function you can not really return a LiftResponse since the function result is an Any ignored

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Alli
Thanks guys, that's very helpful. What I'm doing is using swfupload to let the user upload one or more images (png, gif, jpg etc.). Then I'm gonna resize them and send them back to the user. This is what I guess I'll have to do: 1) Subclass LiftResponse to send the appropriate headers (content-

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Alli
Yeah I think I need to add a custom dispatch function and make that return my own response. I was actually hoping I could do this straight from the snippet instead of having to redirect, makes the whole thing more complex. On Jan 11, 12:41 am, Marc Boschma marc+lift...@boschma.cx wrote: I'm not

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Marius
Alli are you using SHtml.fileUpload ... or you want to upload it manually processing everything in your dispatch? .. I'd opt in for SHtml.fileUpload because there is a bunch of stuff Lift does for you. On Jan 11, 5:12 am, Alli allilis...@gmail.com wrote: Yeah I think I need to add a custom

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Alli
I'm not sure how i would hook SHtml.fileUpload into this because swfupload lets me configure an URL that it will post to for each file uploaded, I don't even need a form to do this (this is all flash/swf). I currently have a LiftView subclass that handles it and is processing it like this:

[Lift] Re: Redirects/new site

2009-01-11 Thread David Pollak
Charles, I'd do a DispatchPF... pseudo-code: val oldToNew: Map[String, String] = Map() DispatchPF { case Req(path, _, _) if oldToNew.contains(path.mkString(/, /, )) = RedirectResponse(path.mkString(/, /, )) } On Sat, Jan 10, 2009 at 12:48 PM, Charles F. Munat c...@munat.com wrote: I

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Charles F. Munat
Isn't prependDispatch now dispatch.prepend? Tim Perrett wrote: Alli, Mark is correct - I'd create a LiftResponse sublass and handle that request with a DispatchPF. If your not familiar, check out prependDispatch in Boot.scala of the demo site. If you can supply a bit more information

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Marius
dispatch is a RulesSeq so you can either append or prepend. I used the term loosely though. On Jan 11, 9:05 pm, Charles F. Munat c...@munat.com wrote: Isn't prependDispatch now dispatch.prepend? Tim Perrett wrote: Alli, Mark is correct - I'd create a LiftResponse sublass and handle that

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread Alli
Thanks chaps, that did the trick. Cheers, Alfred On Jan 11, 3:25 pm, Marius marius.dan...@gmail.com wrote: Ummm ... Does it really need to return a DispatchPf? It could create internally the DispatchPF as just append it to LiftRules dispatch list. On Jan 11, 5:09 pm, David Pollak

[Lift] Re: Writing data to the HttpServletResponse

2009-01-11 Thread David Pollak
Sure thing. Is your app public? I love to see what people have done with Lift... On Sun, Jan 11, 2009 at 8:47 AM, Alli allilis...@gmail.com wrote: Thanks chaps, that did the trick. Cheers, Alfred On Jan 11, 3:25 pm, Marius marius.dan...@gmail.com wrote: Ummm ... Does it really need

[Lift] Replacing a NodeSeq

2009-01-11 Thread Charles F. Munat
Is there a JsCmd for replacing a NodeSeq? I want an AJAX button to run some code on the server, generate a NodeSeq, and then replace the similar NodeSeq on the page. I'm looking through the commands and I don't see how to do that, except to use Run and then JQuery... Am I missing something?

[Lift] Re: Replacing a NodeSeq

2009-01-11 Thread David Pollak
SetHtml(id: String, stuff: NodeSeq) It's a JsCmd and it replaces the contents of the Elem with the give id on the page with stuff. Is this what you were looking for? On Sun, Jan 11, 2009 at 2:58 PM, Charles F. Munat c...@munat.com wrote: Is there a JsCmd for replacing a NodeSeq? I want an

[Lift] Re: Redirects/new site

2009-01-11 Thread Tim Perrett
You do gain portability I agree - it just depends on your setup as to whats best for you, if that means doing the rewrites in lift, then go for it :-) FYI, rewrites with jetty are done like so: http://docs.codehaus.org/display/JETTY/RewriteHandler Cheers, Tim On Jan 11, 7:00 pm, Charles F.

[Lift] Re: Replacing a NodeSeq

2009-01-11 Thread Charles F. Munat
Yeah, I found this and have been playing with it, but am sort of stuck. What I'm doing looks something like this (but is much more complicated): def getForm: NodeSeq = { val widgets = [List(id,name) of unused widgets] if (widgets.isEmpty) spanAll widgets are in use./span else

[Lift] Re: Redirects/new site

2009-01-11 Thread Charles F. Munat
That's good to know. Thanks! Chas. Tim Perrett wrote: You do gain portability I agree - it just depends on your setup as to whats best for you, if that means doing the rewrites in lift, then go for it :-) FYI, rewrites with jetty are done like so:

[Lift] Re: Replacing a NodeSeq (further explanation)

2009-01-11 Thread Charles F. Munat
Essentially, the problem I am having, I think, is that SetHtml hard codes the HTML that will replace the current HTML. I need to use the HTML returned from the AJAX call to replace the current HTML. So I don't think SetHtml is going to work. Does this make more sense? Am I on the right track?