This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Upload and write to local server I got...now I need to move that file to another server, at the same time and be able to allow then to access the file.
It has been suggested to me that I 'consume an EJB' that will enable me to save a file to a different server than the one the site is running on. Because we do not use EJB (this is a Struts based app) I am inclined to look elsewhere foa solution. Can't I simply FTP the file to the alternate server?
I understand the "I need to move that file to another server" part of your question, but I'm not clear on the "at the same time and be able to allow then to access the file".
I don't think using EJBs is really required for the solution - it could be *a* solution, but I think it's a bit of overkill to just back up files to a different server. Plus, it sounds like you're not all that familiar with EJBs, and getting up to speed could take a while.
What specific file transfer mechanism to use is the least of your worries - you can use pretty much any applicable technology that the second server supports - FTP, HTTP, EJBs, web services, writing to a mapped network drive, etc. - however, what you really need to look at is how this affects the flow and performance of your web application.
When a user uploads a file, does the file get sent to the second server during the user's request? Or does it get sent to the second server later by some other means? Depending on network speed and other things, sending the file to the second server during the user's request could make the request take a lot longer. Though if you go with the "file gets sent later" approach, you'll have to look at both the local and remote servers for the file - you won't know if the file has been sent to the second server yet. Also, you'll have to figure out how this "send files to the second server" part works - do you want to write your own separate program that does this? In Java, or just a cron script? Or do you want to run something like Quartz scheduler inside your web app?
How are you going to deal with information about the files? Are you going to go to the remote server every time to get this? Again, this could slow down your web app a lot. You could keep track of this file information in JavaBeans in your web app, but again, this means that you have to capture the information you need to display (file name, size, maybe how to download real file, etc.) when the file is uploaded, and have some way to save or rebuild this information between server re-starts.
Why can't you save files locally, again?
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com