![](/img/trans.png)
[英]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.