A small trap: if using the tomcat manager application, namely the HTML page click reload, launched by the HTTP request url: http://localhost:9032/manager/html/reload; jsessionid=BA373DFB9660EF7F30806C8BA2C6013C? path=/jerryjsp&org.apache.catalina.filters.CSRF_NONCE=9A8CB8A3E37A5A00E9B6B36629CEA257

And if you want to use catalina – ant. The command line to invoke ant jar by reload application, use the url is http://localhost:8080/manager/text/reload? Path = / examples, instead of http://localhost:8080/manager/html/reload? Path =/examples

This feature is useful, for example, for ant to send an email to the administrator after a successful build.

Start by developing a Java utility class for sending mail:

package action;

public class MailSender
{
   public static void main(String[] args)
   {
      String email = args[0];
      notifyAdministratorviaEmail(email);
   }
   public static void notifyAdministratorviaEmail(String email){ 
	   System.out.println("Administrator "+ email + " has been notified"); }}Copy the code

My.class files are in the build/classes folder:



Build.xml Settings:

	<target name="notify">
	      <java dir = '. ' fork="true" fail&westernnerr&westernr="yes" classname="action.MailSender">
	      	<classpath>
	      	   <pathelement path="build/classes" />
	      	</classpath>
	         <arg line="[email protected]"/>
	      </java>
	   </target>
Copy the code

Ant notify, output from the command line:

For more of Jerry’s original articles, please follow the public account “Wang Zixi “: