在JavaEE中将http重定向到https

在JavaEE中将http重定向到https,java,jakarta-ee,web-container,Java,Jakarta Ee,Web Container,如何在Sun Application Server/Web Server中将http重定向到https?一种可能的方法是使用mod_rewrite 我相信还有其他的。如果您在web.xml中将传输保证元素设置为机密或集成,servlet容器应该自动将用户重定向到HTTPS侦听器,如下所示: <security-constraint> <web-resource-collection> <web-resource-name>All<

如何在Sun Application Server/Web Server中将http重定向到https?

一种可能的方法是使用mod_rewrite


我相信还有其他的。

如果您在
web.xml
中将
传输保证
元素设置为
机密
集成
,servlet容器应该自动将用户重定向到HTTPS侦听器,如下所示:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>All</web-resource-name>
        <url-pattern>*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
将重定向到

https://www.example.org/admin/login

有关更多信息,请查看Servlet 2.5规范()。

如果您有一个启用JASPIC的站点,并且validateRequest会检查您是否处于SSL模式,则上述内容在Liberty上不起作用。您好,我使用过它,并且它在该配置中起作用。但问题是它的附加端口类似URL。mydomain.com:8443您知道如何使用https删除此项吗。。?
https://www.example.org/admin/login