Author: scabanovich
Date: 2011-12-05 18:45:29 -0500 (Mon, 05 Dec 2011)
New Revision: 36975
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckResource.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java
Log:
JBIDE-10162
https://issues.jboss.org/browse/JBIDE-10162
Validation of paths of <login-config> in web.xml should support url patterns mapped
to servlets.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckResource.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckResource.java 2011-12-05
23:43:25 UTC (rev 36974)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckResource.java 2011-12-05
23:45:29 UTC (rev 36975)
@@ -30,6 +30,8 @@
String extensions = null;
String extensionMessage = null;
+ boolean canBeServlet = false;
+
public CheckResource(ValidationErrorManager manager, String preference, String attr) {
super(manager, preference, attr);
}
@@ -41,13 +43,18 @@
this.extensionMessage = extensionMessage;
}
+ public CheckResource acceptServlet() {
+ canBeServlet = true;
+ return this;
+ }
+
public void check(XModelObject object) {
String value = object.getAttributeValue(attr);
XModel model = object.getModel();
- XModelObject webRoot = model == null ? null :
model.getByPath("FileSystems/WEB-ROOT"); //$NON-NLS-1$
+ XModelObject webRoot = model == null ? null : FileSystemsHelper.getWebRoot(model);
if(webRoot == null) return;
- if(object.getModelEntity().getName().startsWith("WebAppErrorPage")) {
//$NON-NLS-1$
+ if(canBeServlet) {
if(value != null && value.indexOf("?") > 0) { //$NON-NLS-1$
value = value.substring(0, value.indexOf("?")); //$NON-NLS-1$
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java 2011-12-05
23:43:25 UTC (rev 36974)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/WebXMLCoreValidator.java 2011-12-05
23:45:29 UTC (rev 36975)
@@ -113,11 +113,11 @@
WebAppHelper.TAGLIB_ENTITY);
addCheck(new CheckResource(this, WebXMLPreferences.INVALID_WELCOME_FILE_REF, "file
name", false, ".jsp .html .htm .jspx",
WebXMLValidatorMessages.PATH_NOT_PAGE),
"WebAppWelcomFile");
- addCheck(new CheckResource(this, WebXMLPreferences.INVALID_ERROR_PAGE_REF,
"location", false, null, null),
+ addCheck(new CheckResource(this, WebXMLPreferences.INVALID_ERROR_PAGE_REF,
"location", false, null, null).acceptServlet(),
"WebAppErrorPage");
- addCheck(new CheckResource(this, WebXMLPreferences.INVALID_FORM_ERROR_PAGE_REF,
"form-error-page"),
+ addCheck(new CheckResource(this, WebXMLPreferences.INVALID_FORM_ERROR_PAGE_REF,
"form-error-page").acceptServlet(),
"WebAppLoginConfig");
- addCheck(new CheckResource(this, WebXMLPreferences.INVALID_FORM_LOGIN_PAGE_REF,
"form-login-page"),
+ addCheck(new CheckResource(this, WebXMLPreferences.INVALID_FORM_LOGIN_PAGE_REF,
"form-login-page").acceptServlet(),
"WebAppLoginConfig");
addCheck(new CheckResource(this, WebXMLPreferences.INVALID_JSP_FILE_REF,
"jsp-file"),
WebAppHelper.SERVLET_ENTITY, WebAppHelper.SERVLET_30_ENTITY);