gpt4 book ai didi

java - 在 tomcat + jsf 中的 https 之后重定向到 http

转载 作者:行者123 更新时间:2023-11-28 22:46:05 24 4
gpt4 key购买 nike

我有一个登录页面,我想在 https 中显示。验证用户后,我想把他转回http。

所以我在web.xml中声明

<security-constraint>
<web-resource-collection>
<web-resource-name>Login and Restricted Space URLs</web-resource-name>
<url-pattern>/general/enter.jsf</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

<security-constraint>
<web-resource-collection>
<web-resource-name>Rest of the Application</web-resource-name>
<url-pattern>/general/home.jsf</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

我看到登录页面是 https。

但在我的行动中:

public String doLogin() throws Exception {
...
User user = service.getUserByNameAndCompany(name, company);
......
return "/general/home.jsf";
}

bean 将用户重定向到

https ://mycomputer:8443/MYProject/general/home.jsf

我希望它回来

http: //mycomputer:8080/MYProject/general/home.jsf

我该怎么做?

最佳答案

JSF 导航会将您重定向到同一应用程序中的页面(这意味着您只能在 https://mycomputer:8080/MYProject 内导航)。

你可以做的是导航到像 /general/redirect.jsf 这样的页面,然后从那里使用标题或 javascript 重定向到你想要的 url。

关于java - 在 tomcat + jsf 中的 https 之后重定向到 http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3157412/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com