Create a temporary file, then upload it using FTP (Java webapp) -


users of web application have option start process generates csv file (populated data database) , uploads ftp server (and department read file there). i'm trying figure out how best implement this. use commons net ftp functionality. offers 2 ways upload data ftp server:

  • storefile(string remote, inputstream local)
  • storefilestream(string remote)

it can take while generate csv data think keeping connection open whole time (storefilestream) not best way. that's why want generate temporary file, populate , transfer it.

what best way generate temporary file in webapp? safe , recommended use file.createtempfile?

as long don't create thousands of csv files concurrently upload-time doesn't matter point of view. databases output data row row , if format need csv file recommend not use temporary files @ - conversion on-the-fly:

create inputstream implementation reads database data row row, converts csv , publish data via it's read() methods.

btw: mentioned conversion done web application , can take long time - can problematic default web client has timeout. therefore long lasting process should better done background thread triggered webapp interface.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -