cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Angelo Immediata" <>
Subject Re: From WrapperResponse to HttpResponse
Date Wed, 14 Jun 2006 08:03:44 GMT
Hi Christian.
First of all thanks for your replay.
I know the readers and i have tried to use them...the problem is that if i don't use a cocoon.sendRedirect
i have an error in my portal... the error is something like: streaming of a resource is not
allowed with a reader (i don'tremeber exactly the message and now i can't try it).
I'ld like to avoid the cocoon.sendRedirect and i have tried to catch the response outputStream
and set in it the contenType, the header and my file bytes....only that from portal block
in flow script i have not the HttpRequest but the WrapperRequest.
I have also tried to do in this way:

var nomeFile= cocoon.parameters.filename;
var mut = cocoon.getComponent(;
var respo = mut.getCurrentEnvironment();
cocoon.response.setHeader("Content-Disposition", "attachment; filename=\"" + nomeFile + "\"");
var os = respo.getOutputStream();
var location = percorso.replace('\\','/')+nomeFile+".pdf";
var fis = new new location ) );
var bytesRead = -1;
while ((bytesRead = != -1) {
  print("scaricaPDF errore:"+ex);

This code seems to work..only that a strain thing happens.... in my web browser page appears
an image of the first page of my pdf file while in background acrobat reader is open and shows
my pdf file.
I'ld like, instead, that the user can simply download the file by not open it directly if
he/she has the plugin in the web browser...How can i solve this?

Thanks to all.
---------- Initial Header -----------

>From      : "christian bindeballe"
To          :
Cc          : 
Date      : Tue, 13 Jun 2006 17:46:54 +0200
Subject : Re: From WrapperResponse to HttpResponse

> hi angelo,
> For getting files to users without having the framework "interfere" with
> them in any way, try a reader.
> As described here:
> <map:match pattern="somefile">
>  <map:read src="path/to/file"/>
> </map:match>
> there are other readers than just source-readers, for passing images,
> for example..
> HTH,
> christian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message