首页 文章

JNLP代理通过流问题下载文件

提问于
浏览
0

我正在编写从Web下载CSV文件并将数据插入数据库表中的应用程序 . 问题是我需要通过 System.setProperty("http.proxyHost", "http-proxy.domain.com"); 设置代理等等 . 应用程序工作得很好,当我以某种方式管理它时,我现在面临的问题是,即使应用程序正在运行,它也没有连接到Web - 它会抛出异常消息"connection timeout: connect" .

JNLP文件如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+">
    <information>
        <title>TestImporter</title>
        <vendor>hol</vendor>
        <homepage href=""/>
        <description>TestImporter</description>
        <description kind="short">TestImporter</description>    
    </information>
    <update check="always"/>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.6+"/>
        <jar href="TestImporter.jar" main="true"/>    
        <jar href="lib/ojdbc14.jar"/>
        <jar href="lib/mail.jar"/>
    </resources>
    <application-desc main-class="cz.test.Importer">
    </application-desc>
</jnlp>

我通过以下代码连接到文件:

URLConnection yc = cnb.openConnection();
BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    yc.getInputStream()));

在此先感谢您的帮助!

1 回答

相关问题