为java ejb Webservice启用https [英] Enable https for java ejb Webservice
问题描述
我不需要任何身份验证方法,只需通过https!
Thx
Adem
您需要指定安全连接,如here 。基本上,在您的部署描述符web.xml中,您需要设置:
< security-constraint>
...
< user-data-constraint>
< transport-guarantee> CONFIDENTIAL< / transport-guarantee>
< / user-data-constraint>
< / security-constraint>
但是, NetBeans
将为您插入代码:打开 web.xml
,单击编辑器顶部的安全选项卡,然后单击添加安全约束按钮。键入一个名称,以URL格式写/ *,设置所有Http方法,并指定机密
作为传输保证。
如果您没有 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>
您的应用程序将从现在起使用端口8181。
有关如何在Netbeans Web应用程序中设置安全性的更多信息,请参见此处 此处了解有关证书。
i'm developing a webservice with ejb 3 and glassfish 3.1.1. I'm using Netbeans 7.0 and would like to know, how to enable https on port 8181 for this webservice.
I dont need any authentication method, just secure the communication through https!
Thx
Adem
You need to specify a secure connection as explained here. Essentially, in your deployment descriptor web.xml you need to set:
<security-constraint>
...
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
However NetBeans
will insert the code for you: open web.xml
, click the Security tab along the top of the editor, then click the Add Security Constraint button. Type a name, in URL pattern write /*, set All Http Methods, and specify Confidential
as Transport Guarantee.
If you don't have web.xml
, because you are deploying just the Enterprise Java Bean, create a New GlassFish Descriptor glassfish-ejb-jar.xml
and fill it like this (or see here the file hierarchy):
<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>
Your application will use port 8181 from now on.
See here for further information about how to setup security in a Netbeans web application and here for learning about certificates.
这篇关于为java ejb Webservice启用https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!