You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tobias Rudolph <tr...@wiec.de> on 2005/01/05 10:05:47 UTC

FilePartArray as input for other pipeline

Hello,

I have some problems using FileUploads and the class class
org.apache.cocoon.components.request.multipart.FilePartArray.

In the fist step I'm uploading a file within the upload.xsp. It is the
standard File Upoad example within the cocoon documentation.
I don't want to create a physical file, so I used the FilePartArray. I have
checked the FilePartArray, it contains the uploaded xml file.

<map:match pattern="sample-xsp">
<map:generate src="invoice/xsp/upload.xsp" type="serverpages"/>
<map:serialize/>


upload.xsp:

...
<form method="post" enctype="multipart/form-data" action="sample-xsp">
File:  <input type="file" name="uploaded_file" size="50"/>
<input type="submit" value="upload File"/>
...
<!-- check FilePartArray > OK -->

FilePartArray filePartArray =  (FilePartArray)request.get("uploaded_file");

java.io.BufferedReader in = new java.io.BufferedReader(new
java.io.InputStreamReader(filePartArray.getInputStream()));
String buffer;
while ((buffer = in.readLine()) != null) {
System.out.println(buffer);
}

InputStream is = filePartArray.getInputStream();


In the second step I want the uploaded xml (FilePartArray) file to be the
input for another generator. Here's the sitmap code:

<map:match pattern="sample-xsp3">
<map:generate type="stream"/>
<map:transform src="invoice/stylesheets/xml-fo-stylesheet.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:serialize type="fo2pdf"/>
</map:match>

I have tried to use the stream generator but I only got the null pointer
exception. How can I pass the FilePartArray as
an input to another generator (sample-xsp -> sample-xsp3)?

Thanks
Tobias


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org