【问题标题】:What do you think the best strategy would by to creating a temp XML file, sending it with FTP and then getting rid of it in a web app?你认为最好的策略是创建一个临时 XML 文件,使用 FTP 发送它,然后在 Web 应用程序中删除它?
【发布时间】:2012-05-28 06:47:42
【问题描述】:

我正在使用 Spring 创建一个 Web 应用程序。一项要求是在处理了创建 XML 文档的客户端请求之后,然后通过 FTP 将 XML 发送到 FTP 服务器,然后删除该文件。 您认为最好的策略是创建一个临时 XML 文件,使用 FTP 发送它然后删除它?

【问题讨论】:

    标签: java spring ftp


    【解决方案1】:

    您根本不需要临时文件。如果你的xml文件不大,可以使用DOM在内存中创建文档,然后直接写入FTP流。使用 Apache commons-net 更轻松地进行 ftp 上传。

    【讨论】:

    • 我猜你建议将我的 XML 写入 ByteInputStream 并在完成 FTP 以摆脱它之后。
    • commons-net 为您提供此选项
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-09
    • 2013-03-08
    • 1970-01-01
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 2020-11-08
    相关资源
    最近更新 更多