Hi all.
I'm using cocoon 2.1.7. I'm using the portal block. I have some links where the 
user must download some files. I want to set the output stream in the response; 
in order to do this i have used this code in my flow script:

var respo = cocoon.response;
respo.setContentType("application/download");
respo.setHeader("Content-Disposition", "attachment; filename=\"" + nomeFile + 
"\"");

var resolver = cocoon.getComponent(SourceResolver.ROLE);
var os = respo.getOutputStream();
var location = percorso+nomeFile;
var source = null;
try {
 source = resolver.resolveURI(location);
}finally {
 if (source != null) {
   resolver.release(source);
 }
}
var iss = source.getInputStream() ;
// copia iss nell os
var bytesRead = -1;
while ((bytesRead = iss.read()) != -1) {
 os.write(bytesRead);
}
os.flush();
os.close();

Now i have an error; the error is that setContentType is not a method; i have 
seen that cocoon.response gives to me not the HttpResponse but the 
WrapperResponse...i'ld like to have the HttpResponse from the 
WrapperReponse...how can i do this? As alternative i'ld like to do that when 
the user clicks on the link he/she can download the file directly....how can i 
solve this thing?

Thanks to all...Angelo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to