cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeroen ter Voorde" <>
Subject Re: Return BLOB Value
Date Sat, 27 Jul 2002 13:24:32 GMT
Return BLOB ValueYou can use a Reader to implement this (That's what i did).

(Stripped) Example:

public class Reader extends AbstractReader implements Poolable, Composable {

 Request request = null;
 Response response = null;
 Context context = null;
 ComponentManager manager = null;

 public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws
ProcessingException, SAXException, IOException {
  super.setup(resolver, objectModel, src, par);
  context = ObjectModelHelper.getContext(objectModel);
  request = ObjectModelHelper.getRequest(objectModel);
  response = ObjectModelHelper.getResponse(objectModel);

  public void generate() throws IOException, SAXException, ProcessingException {
  try {
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", 0);

   // out is the outputstream to write your blob data to.

    ((OutputStream)out).write('The blob data');

  } catch (Exception e) {   
   throw new ProcessingException("Error in reader: "+e);

 public String getMimeType() {
  return context.getMimeType(source.substring(source.lastIndexOf("/") + 1));

----- Original Message ----- 
  From: Sascha Kulawik 
  Sent: Friday, July 26, 2002 10:07 PM
  Subject: Return BLOB Value


  I'm trying to implement a File-Upload / Download for a small Forum written in Cocoon XSP.

  Currently Ive no idea how to implement the FileDownload. The easiest way for that would
be to write the data to a mySQL Ressouce and read the data because of Userpermissions and
so on.

  Is it possible, to returm plain BLOB Data from a Database to the User for a Download ? 
  Is there a better way to implement that in Cocoon ? 

  Thank you very much, 


View raw message