Pierre Attar wrote:
Bonjour,
J'essaye de sérialiser un fichier PDF en sortie de FOP. Pour ce faire,
j'ai à peu près fait ce qui est décrit dans :
http://wiki.apache.org/cocoon/SavingFilesToFileSystem
Mais j'ai un soucis, cocoon me répond :
<map:call function> did not send a response, at
file:/T:/proj/cocoon/publish/sitemap.xmap:38:34
La seule chose faite à cet endroit est d'appeler le flowscript :
<map:match pattern="*.pdf">
<map:call function="makepdf">
<map:parameter name="folder"
value="c:\temp"/>
<map:parameter name="filename"
value="{1}"/>
</map:call>
</map:match>
Et mon flowscript est on ne peut plus simple et totalement copié de
l'URL wiki :
function makepdf()
{
var pdf_file;
var outstreamPDF;
// the parameter passed to the script from the pipeline.
// This is the real path to the application context
var folder = Packages.java.lang.String(cocoon.parameters["folder"]);
var filename =
Packages.java.lang.String(cocoon.parameters["filename"]);
try {
// creating links to files
pdf_file = Packages.java.io.File( folder + "\""+filename+".pdf");
// creating outputstream to dump the results of conversion to
the file
outstreamPDF = new Packages.java.io.FileOutputStream( pdf_file );
// calling cocoon pipeline using processPipelineTo() method and
dumping the results to the outputstream
cocoon.processPipelineTo(
"http://localhost/cocoon/publish/"+filename+".do", null, outstreamPDF );
// do not forget to close the outputstream
outstreamPDF.close();
// since the result is dumped to the filesystem we need to send
smth. to the browser
// to make it happy. So let's send just a usual .txt file with
OK message
cocoon.sendPage("c:\\temp\\yes.txt",null) ;
ça ne me semble pas correct, un sendPage est utilisé pour envoyer des
données produites par un pipeline.
} catch( ex ) {
cocoon.log.error(ex);
// Smth. went wrong. Sending a error.txt file to the browser
//cocoon.sendPage("error.txt", null);
A mon avis, c'est par ici que l'on passe car
cocoon.sendPage("c:\\temp\\yes.txt",null) ; doit renvoyer une
exception. Ainsi, on se retrouve dans ce catch ou aucune donnée n'est
renvoyée (pas de sendPage) d'ou l'exception.
}
}
--
Philippe GASSMANN
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/
---------------------------------------------------------------------
Liste francophone Apache Cocoon -- http://cocoon.apache.org/fr/
Pour vous desinscrire : mailto:[EMAIL PROTECTED]
Autres commandes : mailto:[EMAIL PROTECTED]