Ade*_*emC 3 https netbeans web-services ejb
我正在使用ejb 3和glassfish 3.1.1开发一个web服务.我正在使用Netbeans 7.0,并且想知道如何在端口8181上为此Web服务启用https.
我不需要任何身份验证方法,只需通过https保护通信!
谢谢
阿德姆
你需要指定一个安全连接,说明这里.实质上,在您的部署描述符web.xml中,您需要设置:
<security-constraint>
...
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)
但是,NetBeans将为您插入代码:打开web.xml,单击编辑器顶部的"安全"选项卡,然后单击"添加安全约束"按钮.键入名称,在URL模式写入/*,设置所有Http方法,并指定Confidential为运输保证.
如果您没有web.xml,因为您只部署Enterprise Java Bean,请创建一个新的GlassFish描述符glassfish-ejb-jar.xml并像这样填充(或在此处查看文件层次结构):
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>Hello</ejb-name>
<webservice-endpoint>
<port-component-name>Hello</port-component-name>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</webservice-endpoint>
</ejb>
</enterprise-beans>/>
</glassfish-ejb-jar>
Run Code Online (Sandbox Code Playgroud)
从现在开始,您的应用程序将使用端口8181.
有关如何在Netbeans Web应用程序中设置安全性以及此处了解证书的详细信息,请参阅此处.
| 归档时间: |
|
| 查看次数: |
3789 次 |
| 最近记录: |