What is the best way to upload a CSV file through a Java servlet on machine A that gets generated on Machine B?
2 Answers
- Compress the file. Compression typically reduces by 90% the size of CSV files.
- If allowed, use ftp or sftp. There are many apache libraries to do that.
- If ftp not allowed due to security concerns, you might want to use any of the Apache libraries httpclient and httpcore to "POST" the file to your server in B.
3 Comments
syker
Is POST used for large files?
luiscolorado
Yes. Unfortunately, there is no standard limit for HTML 4, AFAIK. In any case, POST allows you to send more data than GET.
Pritam Kumar
in case of GET method we can have only 256 charectors send over the url but in case of POST it has no limit
If you mean CSV generated on machine B, servlet running on machine A:
- process on machine B generates CSV file (or detects it has been generated) then does a http post to push the CSV to the servlet. This can be done in java or any system you like since you're servlet is just expecting HTTP. Here is a Java example. or,
- you could mount a common folder so that machine A and machine B can see the file, and the servlet could periodically check for the file. Since you've said "upload" you probably mean option 1.
2 Comments
syker
Can Perl scripts execute HTTP POSTs?
Paul Jowett
Yes (search.cpan.org/~gaas/libwww-perl-5.836/lib/Net/HTTP.pm), If Perl is a part of your requirements you should state that in your initial post.