dion 02/05/19 23:36:23
Modified: src/java/org/apache/maven/j2ee WarValidator.java
Log:
- Added validation for <form-config-login> login and error page elements.
These resources must exist in the war to pass validation without error.
Revision Changes Path
1.17 +27 -2
jakarta-turbine-maven/src/java/org/apache/maven/j2ee/WarValidator.java
Index: WarValidator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/j2ee/WarValidator.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- WarValidator.java 20 May 2002 04:47:16 -0000 1.16
+++ WarValidator.java 20 May 2002 06:36:23 -0000 1.17
@@ -79,6 +79,7 @@
import org.apache.tools.ant.types.Reference;
import org.apache.maven.executor.AbstractExecutor;
+import org.apache.maven.j2ee.war.FormLoginConfig;
/**
* A task to validate a war file. The following is checked:
@@ -94,8 +95,7 @@
* <taglib-location></code> that exists in the war</li>
* </ol>
* @author dIon Gillard
- * @version $Id: WarValidator.java,v 1.16 2002/05/20 04:47:16 dion Exp $
- * @task add validator for form-login-config
+ * @version $Id: WarValidator.java,v 1.17 2002/05/20 06:36:23 dion Exp $
*/
public class WarValidator extends AbstractExecutor
{
@@ -222,9 +222,11 @@
validateJSPs(war);
validateTaglibs(war);
validateErrorPages(war);
+ validateFormLoginConfig(war);
}
catch (IOException ioe)
{
+ ioe.printStackTrace();
getBroadcaster().fireErrorEvent(new ValidationEvent(this,
getWarFileName(), "Error opening war file for web.xml - " +
"possibly missing manifest"));
@@ -418,6 +420,29 @@
getWarFileName(), "Error reading WEB-INF/web.xml"));
}
}
+
+ /** validate that the <code><form-login-config></code> element, if it
+ * exists contains valid login and error pages
+ */
+ public void validateFormLoginConfig(WarFile war) throws IOException
+ {
+ FormLoginConfig config = war.getFormLoginConfig();
+ if (config != null)
+ {
+ if (!war.hasFile(config.getLoginPage()))
+ {
+ getBroadcaster().fireErrorEvent( new ValidationEvent(this,
+ getWarFileName(), "<form-config-login> login-page location:"
+ + "' " + config.getLoginPage() + "' not found"));
+ }
+ if (!war.hasFile(config.getErrorPage()))
+ {
+ getBroadcaster().fireErrorEvent( new ValidationEvent(this,
+ getWarFileName(), "<form-config-login> error-page location:"
+ + "' " + config.getErrorPage() + "' not found"));
+ }
+ }
+ }
/**
* add a listener to the list to be notified
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>