两台物理服务器之间导文件的问题.

gameboy999 2003-06-30 11:05:55
我们有两个WebApp分别部署在两台机器上面,可是如今需要把一台机器A上面录入的文档附件在经过一系列处理后传到另外一台机器B的指定目录下面.

我想过的方案倒是不少,可是都觉得不是很爽.大家帮忙参考一下,谢谢!


1. 机器A在处理后模拟HTTP的File post,把本地文档通过机器B的servlet"上传"到机器B. (我知道如何模拟get和普通的post,但不知道如何模拟input = file...)

2.机器A在处理以后请求机器B的某个servlet,我模拟断点续传,将数据一段一段的传到机器B,然后写入文档..(我可能有多个附件,感觉操作复杂了)

3.机器A在处理后,利用ftp模块将文件ftp到机器B (这个方案我觉得可行度倒是比较高)

4.机器A在处理以后,利用机器B的EJB组件一次性把文件读入内存再写入到机器B中..
(感觉这个没准比3还方便,不过要求机器B需要EJB container)

5.把4中的EJB换成Webservice组件...(想想免费的Webservice服务器..基本上不敢想了)

大家帮忙提些意见,谢谢,100分奉上,如果有更好的解决方案,另外开贴散分!
...全文
27 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
gameboy999 2003-07-01
  • 打赏
  • 举报
回复
up...
takecare 2003-07-01
  • 打赏
  • 举报
回复
6. disk array
gameboy999 2003-07-01
  • 打赏
  • 举报
回复
up~
gameboy999 2003-07-01
  • 打赏
  • 举报
回复
谢谢楼上2位,给分
fuchunjie 2003-07-01
  • 打赏
  • 举报
回复
到网上查找ftp-1.2.2.tar.gz,这是个纯java的jar.直接使用既可.上面的代码是Client的示例.....
fuchunjie 2003-07-01
  • 打赏
  • 举报
回复
public static void ftp_file(String localPath,ArrayList filename,String directory,String removeHost,String user,String password) {
try {

// connect and test supplying port no.
FTPClient ftp = new FTPClient(removeHost,21);
ftp.login(user, password);
ftp.quit();

// connect again
ftp = new FTPClient(removeHost);
// switch on debug of responses
ftp.debugResponses(true);
ftp.login(user, password);

// binary transfer
ftp.setType(FTPTransferType.BINARY);
ftp.setConnectMode(FTPConnectMode.ACTIVE);
// change dir
ftp.chdir(directory);
// put a local file to remote host
ListIterator list=filename.listIterator();
while (list.hasNext()) {
String temp_filename=(String)list.next();
if (temp_filename!=null)
ftp.put(localPath+temp_filename,temp_filename,true);
}
ftp.quit();
}
catch (IOException ex) {
System.out.println("Caught exception1: " + ex.getMessage());
}
catch (FTPException ex) {
System.out.println("Caught exception2: " + ex.getMessage());
}
georgeqp 2003-07-01
  • 打赏
  • 举报
回复
开ftp
参考下面的文章,有源码
http://tech.163.com/tm/030321/030321_87056.html
http://www.enterprisedt.com/downloads/ftp/doc/com/enterprisedt/net/ftp/FTPClient.html#put
http://www.zdnet.com.cn/developer/code/story/0,2000081534,39105138,00.htm
http://www.enterprisedt.com/downloads/ftp/doc/index.html
homeness 2003-07-01
  • 打赏
  • 举报
回复
开个ftp

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧