[英]Eclipse reporting problem in my web.xml, but it is processed fine
I'm using Google App Engine with the Google plugin in Eclipse, here is the header of my web.xml:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
基於一些 GAE 文檔,我添加了以下內容:
<security-constraint>
<web-resource-collection>
<url-pattern>/tasks/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
然而 Eclipse 在“url-pattern”報錯:
cvc-complex-type.2.4.a:發現以元素“url-pattern”開頭的無效內容。
'{"http://java.sun.com/xml/ns/javaee":web-resource-name}' 之一是預期的。
我可以啟動應用程序,它似乎可以處理 web.xml 文件,但我不喜歡 Eclipse 報告錯誤的事實。 問題是什么?
好吧,錯誤似乎很簡單——它在 url 模式之前預期的 web-resource-name 標記:)
干杯
只是為了添加確切的代碼
<security-constraint>
<web-resource-collection>
<web-resource-name>tasks</web-resource-name>
<url-pattern>/tasks/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
正如@peshkira 所說,問題是缺少參數。 但由於 web.xml 文件是由 Google 工具生成的,我認為生成文件的 Google 工具可能有問題。
就我而言,我正在關注https://developers.google.com/appengine/docs/java/dataprocessing/mapreduce_config#the_webxml_file來試用 Google 模塊( https://developers.google.com/appengine/docs/java/ modules/ )和 Z32F7222026696F3078EZ3857889194DEE 的 Web 工具平台 (WTP) ( https://developers.google.com/appengine/docs/java/webtoolsplatform )。
所以我向 Google Cloud Support 提交了一份支持票,這是他們提供的答案:
經過一番研究,這是由於
<web-resource-name>
實際上丟失了。 在代碼中並非絕對需要它,但根據我們的文檔[1] 建議使用它。這是如何解決它的示例。 我還確認它修復了我的錯誤:
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<url-pattern>/*</url-pattern> </web-resource-collection>
</web-resource-collection>
我還將提前 go 並建議將其添加到我們的源文件中,因為它們在技術上應該存在。
感謝您報告此事。
真摯地,
艾伯特雲平台支持
[1] 安全和身份驗證: https://developers.google.com/appengine/docs/java/config/webxml#Security_and_Authentication
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.