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- disposition, content-length etc) and the write the file to the response 2) Do some stuff in Boot.scala to hook my new response in when a specific URL is being used e.g. /downloadimage. Cheers, Alli On Jan 11, 12:08 pm, Tim Perrett <[email protected]> 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 about what exacty you want to > do (I'm guessing you want to force downlod a PDF or something?) then > we can give you a more specific answer. > > Cheers > > Tim > > On Jan 11, 12:41 am, Marc Boschma <[email protected]> wrote: > > > I'm not an expert but I would model a Response class in much the same > > way as: > > > package net.liftweb.http > > > object PlainTextResponse { > > def apply(text: String): PlainTextResponse = > > PlainTextResponse(text, Nil, 200) > > def apply(text: String, code: Int): PlainTextResponse = > > PlainTextResponse(text, Nil, code) > > } > > > case class PlainTextResponse(text: String, headers: List[(String, > > String)], code: Int) extends LiftResponse { > > def toResponse = { > > val bytes = text.getBytes("UTF-8") > > InMemoryResponse(bytes, ("Content-Length", > > bytes.length.toString) :: ("Content-Type", "text/plain") :: headers, > > Nil, code) > > } > > } > > > from TextResponse.scala. Look at InMemoryResponse or possibly > > StreamingResponse in Response.scala. > > > Marc > > > On 11/01/2009, at 4:27 AM, Alli wrote: > > > > Hey, I have been searching the list and also the liftweb.net wiki and > > > haven't found a way to do this: > > > > I have a form to upload a file that I want to manipulate and send back > > > to the client. When sending it back I am using S.setHeader to set the > > > content type, disposition etc but I haven't found a way to write the > > > file back to the response. What I think I need is access to the > > > response's printwriter (response.getWriter()) instance. Any help would > > > be greatly appreciated. > > > > Cheers, > > > Alli --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
