避免在 org.eclipse.jetty.server.ssl.SslSocketConnector 和 jetty-maven-plugin 中使用已弃用的方法
与
如何在不使用连接器中已弃用的方法/标签(如 needClientAuth 或 keystore)的情况下编写正确的 Maven POM?
使用已弃用的方法的示例:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<!-- see http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin -->
<version>8.0.4.v20111024</version>
<!-- see http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.mortbay.jetty%22%20AND%20a%3A%22jetty-maven-plugin%22 -->
<dependencies>
<!--[...]-->
</dependencies>
<configuration>
<webAppXml>src/main/resources/jetty-Login.xml</webAppXml>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webAppConfig>
<contextPath>/MyApp</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
<port>8080</port>
</connector>
<connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
<port>8443</port>
<password>changeit</password>
<wantClientAuth>true</wantClientAuth><!-- deprecated! -->
<needClientAuth>false</needClientAuth><!-- deprecated! -->
<keystore>/my/path/to/java/keystore</keystore><!-- deprecated! -->
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
Releated to
How to write correct Maven POM without using the deprecated methods / tags in connector like needClientAuth or keystore?
Example with deprecated method use:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<!-- see http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin -->
<version>8.0.4.v20111024</version>
<!-- see http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.mortbay.jetty%22%20AND%20a%3A%22jetty-maven-plugin%22 -->
<dependencies>
<!--[...]-->
</dependencies>
<configuration>
<webAppXml>src/main/resources/jetty-Login.xml</webAppXml>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webAppConfig>
<contextPath>/MyApp</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
<port>8080</port>
</connector>
<connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
<port>8443</port>
<password>changeit</password>
<wantClientAuth>true</wantClientAuth><!-- deprecated! -->
<needClientAuth>false</needClientAuth><!-- deprecated! -->
<keystore>/my/path/to/java/keystore</keystore><!-- deprecated! -->
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 Maven 配置结构进行自定义 Ssl 配置是不可能的。
这是由于在 SslSocketConnector 构造函数上引入了 SslContextFactory 要求,以加强服务器端的一些 SSL 安全问题。
当使用 pom.xml 中的结构时,Maven 只能从默认构造函数构造对象。
您必须通过
元素桥接更改。去获取 jetty-ssl.xml 从发行版并将其放入 ${project.basedir}/src/main/config/jetty-ssl.xml 中并使用以下配置块。
A custom Ssl configuration via the maven configuration structure isn't possible.
This is due to the introduction of the SslContextFactory requirement on the SslSocketConnector constructor to tighten up some SSL security issues on the server side.
Maven can only construct objects from the default constructor when using the structures in the pom.xml.
You'll have to bridge the change via the
<jettyXml>
element.Go grab a copy of the jetty-ssl.xml from the distribution and put it into your ${project.basedir}/src/main/config/jetty-ssl.xml and use the following configuration block.