• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Upload File, Save to different server

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Any guidance or solution or idea is welcome...

TIA,
Christopher

 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
His brain is the size of a cherry pit! About the size of this ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic