【发布时间】:2016-09-12 07:17:23
【问题描述】:
我对 HTTPS 很陌生,我正在尝试从 OSGi 包中托管一个 Jetty HTTPS 服务器。当我在运行配置中将以下属性作为 VM 参数传递时,一切正常,但由于这不是我的选择,我使用 System.setProperties()在 Activator 的启动方法中提供参数> 方法。
System.setProperty("org.eclipse.equinox.http.jetty.https.port", "9090");
System.setProperty("org.eclipse.equinox.http.jetty.https.enabled", "true");
System.setProperty("org.eclipse.equinox.http.jetty.https.host", "0.0.0.0");
System.setProperty("org.eclipse.equinox.http.jetty.ssl.keystore", "/home/https/keystore.jks");
System.setProperty("org.eclipse.equinox.http.jetty.ssl.password", "password");
使用这种方法,端口 9090 上的 HTTPS 服务器工作正常,但有两个问题,
-
同样的网页也在端口 80 上作为我不想要的 HTTP 提供。即使我使用它也存在:
System.setProperty("org.eclipse.equinox.http.jetty.http.enabled","false"); 由于不需要的 HTTP 网页托管在端口 80(系统端口)上,我必须以 root 身份调用捆绑包,否则我会得到 Java.net.SocketException: Permission Denied
由于端口 80 上可能托管了其他页面,我不想完全禁用 HTTP 或从我的捆绑包中的端口 80 手动取消注册服务器。
我非常感谢任何关于如何停止这种行为而无需手动修改任何其他端口的指针。
【问题讨论】:
标签: java jetty osgi embedded-jetty