[英]HTTP Post method not supported by this URL when deployed to jboss EAP 7.1
[英]HTTP method POST is not supported by this URL on JBOSS
我们必须为 Struts-1 上的一个遗留应用程序设置 MS azure 活动目录身份验证,它将在 JBOSS EAP-7 上运行。
基本设置是这样的。 我们有一个名为 index.html 的欢迎文件,如下所示。
<html>
<head>
<title>TITLE</title>
</head>
<FRAMESET border=0 name=fs_rep ROWS="18%,*">
<FRAME SRC="heading.html" NAME="HEADING">
<FRAME SRC="logon.jsp" NAME="DISPLAY">
</FRAMESET>
<NOFRAMES>
This browser does not support frames. The application cannot be displayed.
</NOFRAMES>
</html>
当应用程序启动时,用户会看到登录页面,提供凭据,然后请求转到执行 LDAP 验证的 LoginAction 类。
我们正在关注此链接https://docs.microsoft.com/en-us/azure/active-directory/active-directory-devquickstarts-webapp-java以设置 MS AD 身份验证。
我们在 web.xml 中创建了一个基本过滤器作为
<filter-name>BasicFilter</filter-name>
<url-pattern>/index.html</url-pattern>
此筛选器具有用于身份验证的代码并将用户重定向到 Azure 登录页面。 我们在 azure 中给出了“响应 URL”: http://localhost:8001/MyApp/index.html
此设置适用于 Weblogic 服务器,但是当我尝试在 JBOSS EAP-7 上部署相同的设置时,它会将我们带到 MS Azure 注册页面,我们提供凭据,基本过滤器运行,最后显示“ HTTP 方法 POST 不是浏览器中的此 URL 支持“。
我们走错路了吗? URL 如何支持 POST(仅在 JBOSS 中发生)
似乎 JBoss 默认不支持.html
文件的 HTTP 方法POST
,这与其他 servlet 引擎不同。
根据我的经验,我认为有一些方法可以解决这个问题。
这似乎是 JBoss 的安全约束,可以通过尝试在项目的web.xml
文件中设置以下配置来更改。
<security-constraint> <display-name>Example Security Constraint</display-name> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <url-pattern>/index.html</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> </security-constraint>
作为解决方法,您可以尝试将index.html
重命名为index.jsp
。 这会将您的 HTML 编译为在 JBoss serlvet 容器上运行的 JSP,并且 JSP 始终使用service()
方法,这应该可以避免 JBoss 上的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.