Hello all. Just joined the list, so I figured I'd jump right in. :)

I have a couple of enhancements to the War task.

Here is the motivation.

1) If you specify a prefix to a <webinf>, if would prepend WEB-INF to the
prefix, allowing arbitrary prefixes in the webinf.

2) Having a <jsp> tag. This would put files in "WEB-INF/jsp". This seems to
be the de facto standard for placing protected JSPs in a war.

And here is the patch:

Index: src/main/org/apache/tools/ant/taskdefs/War.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/War.java,v
retrieving revision 1.23
diff -u -r1.23 War.java
--- src/main/org/apache/tools/ant/taskdefs/War.java     15 Apr 2002 13:36:17 
-0000      1.23
+++ src/main/org/apache/tools/ant/taskdefs/War.java     24 Apr 2002 04:39:14 
-0000
@@ -123,7 +123,20 @@
 
     public void addWebinf(ZipFileSet fs) {
         // We just set the prefix for this fileset, and pass it up.
-        fs.setPrefix("WEB-INF/");
+        // BPC: If the prefix is already set in fs, then prepend
+        // WEB-INF to it to allow arbitrary prefixes, without 
+        // hard-coding WEB-INF.
+        if ( "".equals(fs.getPrefix())) {
+            fs.setPrefix("WEB-INF/");
+        } else {
+            fs.setPrefix("WEB-INF/" + fs.getPrefix());
+        }
+        super.addFileset(fs);
+    }
+
+    public void addJsp(ZipFileSet fs) {
+        // We just set the prefix for this fileset, and pass it up.
+        fs.setPrefix("WEB-INF/jsp/");
         super.addFileset(fs);
     }
 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to