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:
try{
var nomeFile= cocoon.parameters.filename;
var mut =
cocoon.getComponent(Packages.org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade.ROLE);
var respo = mut.getCurrentEnvironment();
respo.setContentType("application/download");
cocoon.response.setHeader("Content-Disposition", "attachment; filename=\"" +
nomeFile + "\"");
var os = respo.getOutputStream();
var location = percorso.replace('\\','/')+nomeFile+".pdf";
var fis = new Packages.java.io.FileInputStream( new Packages.java.io.File(
location ) );
var bytesRead = -1;
while ((bytesRead = fis.read()) != -1) {
os.write(bytesRead);
}
os.flush();
os.close();
fis.close();
}catch(ex){
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.
Angelo.
---------- Initial Header -----------
>From : "christian bindeballe" [EMAIL PROTECTED]
To : [email protected]
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:
>
> http://cocoon.apache.org/2.1/userdocs/readers.html
>
> <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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]