Hi all, I have a servlet/jsp forum application which supports image upload. For storage space reasons, I would like to write the uploaded images to a different server than the one hosting my web app. Obviously I will also need to read the image data from there.
I am having difficulties sorting out my file permissions - if I fix this will I be able to read and write to absolute file URLs? Or is it more complicated than that... ?
If the remote file system is mounted via NFS it should work just like it would locally, assuming all permissions are set appropriately. If the remote file system is accessed via SMB it gets a bit more complicated. [ August 21, 2006: Message edited by: Ulf Dittmer ]
Joined: Feb 20, 2004
Hi, Do I really need to mount the remote file system? Is this a basic security feature of java, that it can't write to a folder on a remote web server?
My case is complicated by the fact that my web app is a plugin in a larger application, and I don't have direct access to the web server which runs it. So I'd prefer not to have to set up mounted file systems.
Do I really need to mount the remote file system? Is this a basic security feature of java, that it can't write to a folder on a remote web server?
Java can't magically reach into other machines to read and write to their file systems. There has to be some mechanism in place for it to do so. A possible alternative is to set up a service on the remote system that does the reading and writing for you. This could be a web service, FTP server, webdav server, etc...
Hi, I have ftp running on the remote server, and I could also run a servlet there to read and write the images. What would people's best solution be, in terms of efficiency and speed? My first experiments with ftping from my servlet have been unsuccessful.... Thanks.
Joined: Mar 22, 2005
I'd say go with ftp (instead of something HTTP-based). What problems did you encounter using FTP from within a servlet? Using Jakarta Commons Net I had no issues last time I did it (although it ran in a separate thread, not the servlet itself).
Joined: Feb 20, 2004
I tried some basic ftp transactions using com.fooware.net. The application just hung when trying to connect - no error message. I'll try it again from a stand alone java app., and will take a look at jakarta commons net too..