Index: AbstractCatalinaTask.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java,v retrieving revision 1.2 diff -u -r1.2 AbstractCatalinaTask.java --- AbstractCatalinaTask.java 6 Oct 2003 09:04:43 -0000 1.2 +++ AbstractCatalinaTask.java 12 Jan 2004 04:55:52 -0000 @@ -1,5 +1,5 @@ /* - * $Header: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java,v 1.2 2003/10/06 09:04:43 remm Exp $ + * $Header: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java,v 1.2 2003/10/06 09:04:43 remm Exp $ * $Revision: 1.2 $ * $Date: 2003/10/06 09:04:43 $ * @@ -70,6 +70,7 @@ import java.net.URL; import java.net.URLConnection; import org.apache.catalina.util.Base64; +import org.apache.catalina.manager.ManagerServlet; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -81,6 +82,7 @@ * undeploying applications. These tasks require Ant 1.4 or later. * * @author Craig R. McClanahan + * @author TANAKA Yoshihiro * @version $Revision: 1.2 $ $Date: 2003/10/06 09:04:43 $ * @since 4.1 */ @@ -142,6 +144,20 @@ } + /** + * The virtual host of the Manager application to be used. + */ + protected String host = null; + + public String getHost() { + return (this.host); + } + + public void setHost(String host) { + this.host = host; + } + + // --------------------------------------------------------- Public Methods @@ -183,6 +199,8 @@ * Execute the specified command, based on the configured properties. * The input stream will be closed upon completion of this task, whether * it was executed successfully or not. + * When {@link getHost()} returns a value(not null), 'host' parameter + * will be added to the command. * * @param command Command to be executed * @param istream InputStream to include in an HTTP PUT, if any @@ -200,6 +218,17 @@ try { // Create a connection for this command + if (command.indexOf("?") >= 0) { + // When virtual host is specified + if (getHost() != null && !"".equals(getHost())) { + command = command + "&" + ManagerServlet.VIRTUAL_HOST + "=" + getHost(); + } + } else { + // When virtual host is specified + if (getHost() != null && !"".equals(getHost())) { + command = command + "?" + ManagerServlet.VIRTUAL_HOST + "=" + getHost(); + } + } conn = (new URL(url + command)).openConnection(); HttpURLConnection hconn = (HttpURLConnection) conn;