Hey guys,

Using the excellent tutorials provided on a Wordpress blog, I managed
to make my Struts2 Java application upload a zip and be ready to be
used as an Input Stream, while the file uploaded is in the form of a
String - using the hack GaeFilterDispatcher upload interceptor.
Tutorial here: 
http://whyjava.wordpress.com/2009/10/04/file-upload-on-google-app-engine-using-struts2/

However I am quite stuck up on how I can extract this zip file, to use
the contents of the file for blah blah blah (without storing them -
but that part is not the problem). I do not understand the right way
to use the input stream of the fileupload interceptor and extracting
it. Here is my code:

...
final int BUFFER = 1024;
        try {
            BufferedOutputStream bos = null;
            ZipInputStream zis = new ZipInputStream(new
BufferedInputStream(zipName));
            ZipEntry entry;
            while ((entry = zis.getNextEntry()) != null) {
                test += "Extracting: " + entry;
                csvGotList.add(entry.toString());
...

Where zipName is the an InputStream object from the interceptor for
GAE.

I have worked previously with the file unzipping tutorial on the
Oracle/Sun website, which works very smoothly on Tomcat server.

Current problem: the application does not enter the while loop, which
makes it seems like zis has no entries. I have no clue why.

Do I need to make the String object (of the zip uploaded) into a
byte[] and then use it? Or should I make the InputStream persistent
first and then try and extract it with the same code I am using above?
Please Please Please suggest how I should go about it.


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to