简体   繁体   English

JBOSS 上的此 URL 不支持 HTTP 方法 POST

[英]HTTP method POST is not supported by this URL on JBOSS

We have to setup MS azure active directory authentication for one of our legacy application which is on Struts-1, will run on JBOSS EAP-7.我们必须为 Struts-1 上的一个遗留应用程序设置 MS azure 活动目录身份验证,它将在 JBOSS EAP-7 上运行。

The basic setup is like this.基本设置是这样的。 We have a welcome file called index.html as below.我们有一个名为 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>

When the application starts user sees the login page, gives the credentials and the request goes to LoginAction class which does the LDAP verification.当应用程序启动时,用户会看到登录页面,提供凭据,然后请求转到执行 LDAP 验证的 LoginAction 类。

We are following this link https://docs.microsoft.com/en-us/azure/active-directory/active-directory-devquickstarts-webapp-java for setting up MS AD Authetication.我们正在关注此链接https://docs.microsoft.com/en-us/azure/active-directory/active-directory-devquickstarts-webapp-java以设置 MS AD 身份验证。

We have created a basic filter in web.xml as我们在 web.xml 中创建了一个基本过滤器作为

<filter-name>BasicFilter</filter-name>
<url-pattern>/index.html</url-pattern>

This filter has code for authentication and redirects user to Azure login page.此筛选器具有用于身份验证的代码并将用户重定向到 Azure 登录页面。 We have given the "Response URL" in azure as: http://localhost:8001/MyApp/index.html我们在 azure 中给出了“响应 URL”: http://localhost:8001/MyApp/index.html

This setup works fine with Weblogic server, but when I try to deploy the same on JBOSS EAP-7, it takes us to MS Azure signup page, we give credentials, the basic filter runs, and finally it shows " HTTP method POST is not supported by this URL " in the browser.此设置适用于 Weblogic 服务器,但是当我尝试在 JBOSS EAP-7 上部署相同的设置时,它会将我们带到 MS Azure 注册页面,我们提供凭据,基本过滤器运行,最后显示“ HTTP 方法 POST 不是浏览器中的此 URL 支持“。

Are we on wrong track?我们走错路了吗? How is POST to be supported for the URL (happens only in JBOSS) URL 如何支持 POST(仅在 JBOSS 中发生)

It seems that HTTP method POST for .html file is not supported default on JBoss which is different from other servlet engines.似乎 JBoss 默认不支持.html文件的 HTTP 方法POST ,这与其他 servlet 引擎不同。

Per my experience, I think there are some way to solve the issue.根据我的经验,我认为有一些方法可以解决这个问题。

  1. It seems like a security constraint on JBoss which may be changed via try to set the below configuration in the web.xml file of your project.这似乎是 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>
  2. As a work around, you can try to rename your index.html to index.jsp .作为解决方法,您可以尝试将index.html重命名为index.jsp This will compile your HTML as a JSP run on JBoss serlvet container, and a JSP always uses the service() method and this should avoid the issue on JBoss.这会将您的 HTML 编译为在 JBoss serlvet 容器上运行的 JSP,并且 JSP 始终使用service()方法,这应该可以避免 JBoss 上的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM