Search code examples
web-servicesfile-uploadjakarta-eeappletapplication-server

How can I upload a Zipfile to my Application Server using an Applet


I use an applet to bundle some files into a zip and during that I create a description-object. I already utilize JavaEE Webservices to send the description-object to the server but how do I transport my zip?

I'm fairly new to Java EE and want to know if there is a common way to do that already (since java ee offers a lot) or would I use something ordinary like ftp?

I imagine something like a takeFileWebService that I can use from my applet, which then calls some Method onFileReceived on the serverside to handle the file, dunno :/

Thank in advance, philipp


Solution

  • I'm using kind of an uncommon, maybe even insecure way now. Since I need to send a describing Object anyway I just appended my file as an array of bytes.

    I lookup my TakeStuffEJB via JNDI, and then I'll invoke a remote-method that wants a byte[] as parameter. I do CRC32 integrity checks on client and server side and it works. There is a limit to filesize though. Files above 20 MB whill throw a MarshalException("Not Completed") after a while.

    Maybe this is insane because I don't think RMI was designed for filetransfers. But I'll give it a try since the files I'm sending a rarely larger than 1 MB.