You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/06/15 20:27:12 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant DeployTask.java InstallTask.java RemoveTask.java
remm 2003/06/15 11:27:12
Modified: catalina/src/share/org/apache/catalina/ant DeployTask.java
InstallTask.java RemoveTask.java
Log:
- Update the Ant tasks as described in the updated documentation.
- Install and remove will still be present for compatibility, but are deprecated.
Revision Changes Path
1.2 +97 -14 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java
Index: DeployTask.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeployTask.java 18 Jul 2002 16:48:13 -0000 1.1
+++ DeployTask.java 15 Jun 2003 18:27:11 -0000 1.2
@@ -87,6 +87,35 @@
/**
+ * URL of the context configuration file for this application, if any.
+ */
+ protected String config = null;
+
+ public String getConfig() {
+ return (this.config);
+ }
+
+ public void setConfig(String config) {
+ this.config = config;
+ }
+
+
+ /**
+ * URL of the server local web application archive (WAR) file
+ * to be deployed.
+ */
+ protected String localWar = null;
+
+ public String getLocalWar() {
+ return (this.localWar);
+ }
+
+ public void setLocalWar(String localWar) {
+ this.localWar = localWar;
+ }
+
+
+ /**
* The context path of the web application we are managing.
*/
protected String path = null;
@@ -101,6 +130,34 @@
/**
+ * Tag to associate with this to be deployed webapp.
+ */
+ protected String tag = null;
+
+ public String getTag() {
+ return (this.tag);
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+
+ /**
+ * Update existing webapps.
+ */
+ protected boolean update = false;
+
+ public boolean getUpdate() {
+ return (this.update);
+ }
+
+ public void setUpdate(boolean update) {
+ this.update = update;
+ }
+
+
+ /**
* URL of the web application archive (WAR) file to be deployed.
*/
protected String war = null;
@@ -129,22 +186,48 @@
throw new BuildException
("Must specify 'path' attribute");
}
- if (war == null) {
+ if ((war == null) && (localWar == null) && (tag == null)) {
throw new BuildException
- ("Must specify 'war' attribute");
+ ("Must specify either 'war', 'localWar', or 'tag' attribute");
}
+
+ // Building an input stream on the WAR to upload, if any
BufferedInputStream stream = null;
+ String contentType = null;
int contentLength = -1;
- try {
- URL url = new URL(war);
- URLConnection conn = url.openConnection();
- contentLength = conn.getContentLength();
- stream = new BufferedInputStream(conn.getInputStream(), 1024);
- } catch (IOException e) {
- throw new BuildException(e);
+ if (war != null) {
+ try {
+ URL url = new URL(war);
+ URLConnection conn = url.openConnection();
+ contentLength = conn.getContentLength();
+ stream = new BufferedInputStream(conn.getInputStream(), 1024);
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ contentType = "application/octet-stream";
+ }
+
+ // Building URL
+ StringBuffer sb = new StringBuffer("/deploy?path=");
+ sb.append(URLEncoder.encode(this.path));
+ if ((war == null) && (config != null)) {
+ sb.append("&config=");
+ sb.append(URLEncoder.encode(config));
}
+ if ((war == null) && (localWar != null)) {
+ sb.append("&war=");
+ sb.append(URLEncoder.encode(localWar));
+ }
+ if (update) {
+ sb.append("&update=true");
+ }
+ if ((war != null) && (tag != null)) {
+ sb.append("&tag=");
+ sb.append(URLEncoder.encode(tag));
+ }
+
execute("/deploy?path=" + URLEncoder.encode(this.path), stream,
- "application/octet-stream", contentLength);
+ contentType, contentLength);
}
1.2 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/InstallTask.java
Index: InstallTask.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/InstallTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InstallTask.java 18 Jul 2002 16:48:13 -0000 1.1
+++ InstallTask.java 15 Jun 2003 18:27:11 -0000 1.2
@@ -75,6 +75,7 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
* @since 4.1
+ * @deprecated Replaced by DeployTask
*/
public class InstallTask extends AbstractCatalinaTask {
1.2 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/RemoveTask.java
Index: RemoveTask.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/RemoveTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RemoveTask.java 18 Jul 2002 16:48:13 -0000 1.1
+++ RemoveTask.java 15 Jun 2003 18:27:11 -0000 1.2
@@ -74,6 +74,7 @@
*
* @author Craig R. McClanahan
* @version $Revision$ $Date$
+ * @deprecated Replaced by UndeployTask
*/
public class RemoveTask extends AbstractCatalinaTask {
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org