我们有一个使用Java WebStart部署的应用程序。有一个JEditorPane显示一些HTML内容。此HTML还包含图像。如果服务器返回HTTP 3xx staus代码,因为移动了实际资源,则会显示WebStart安全对话框。该对话框要求用户确认应该是否允许应用程序从某个主机获取数据。
一个非常简单的示例应用程序:
package test;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class Main extends JFrame {
public Main() {
JEditorPane p = new JEditorPane();
p.setContentType("text/html");
p.setEditable(false);
p.setText("<html><img src=\"XXXX\" /></html>");
add(p);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 500);
setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new Main();
}
});
}
}
XXXX - &gt; http://www.hon.ch/HONcode/Seal/HONConduct432264.jpg 出现安全对话框
XXXX - &gt; http://www.uni-due.de/imperia/md/images/cms/ude-logo.png 出现否安全对话框
JNLP文件:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" codebase="." href="xxx.jnlp">
<information>
<title>xxx</title>
<vendor>xxx</vendor>
</information>
<security>
<all-permissions/>
</security>
<update check="always" policy="always" />
<resources>
<java version="1.7+" java-vm-args="-Xmx150m" />
<jar href="xxx-signed.jar" main="true" />
</resources>
<application-desc main-class="test.Main">
</application-desc>
</jnlp>
是否有一种简单的方法可以禁用这些安全对话框?如果不是,我们必须通过我们的应用程序后端获取图像。