Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
thẻ Content Nội dung được sử dụng để xuất thông tin. Các thẻ này là đồng nghĩa với phương thức getter mà trả về một chuỗi. Các thẻ nội dung không bao giờ có những thông tin lồng nhau. Đoạn dưới đây cho thấy làm thế nào để sản xuất các tên phương pháp hiện tại bằng cách sử dụng thẻ trong mẫu Phương pháp xây dựng. | public abstract class AbstractTomcatTask extends Task private TomcatSupport tomcatsupport Overrides the base class implementation to instantiate the code TomcatSupport code class. public void init this.tomcatSupport new TomcatSupport this getScriptToExecute isStarting @return the name of the script to execute. For Tomcat 4.0 and higher a valid filename might be startup . The name of the script should strong not strong include the extension. public abstract String getScriptToExecute @return true if Tomcat is being started false if Tomcat is being stopped. public abstract boolean isStarting Called by Ant to start the execution of the target. public void execute throws BuildException this.tomcatSupport.execute Called by Ant to set the attribute testURL . This attribute is referenced in the buildfile. @param testURL a URL that is used to connect to Tomcat. This URL is used to validate that Tomcat is running. public void setTestURL String testURL this.tomcatSupport.setTestURL testURL Called by Ant to set the attribute catalinaHome . This attribute is referenced in the buildfile. @param catalinaHome the full path to where Tomcat is installed. public void setCatalinaHome String catalinaHome this.tomcatSupport.setCatalinaHome catalinaHome @param timeout a number representing the timeout in milliseconds. The timeout must be greater than 10 seconds 10000 ms and less than 60 seconds 60000 ms . public void setTimeout String timeout try long temp Long.parseLong timeout if temp 10000 temp 60000 this.tomcatSupport.setTimeout temp else throw new BuildException Invalid timeout value timeout . The timeout must be between 10000 and 60000. catch NumberFormatException nfe throw new BuildException Invalid timeout value timeout This task defines three attributes 1. The testURL attribute specifies a URL that is used to determine when the server is started. For example http localhost 8080. 2. The catalinaHome attribute specifies where Tomcat is installed. This is the same as the .