2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.jk.status;
20 import java.io.UnsupportedEncodingException;
21 import java.net.URLEncoder;
23 import org.apache.tools.ant.BuildException;
26 * Ant task that implements the <code>/jkstatus?cmd=reset&w=loadbalancer</code> command, supported by the
27 * mod_jk status (1.2.20) application.
29 * @author Peter Rossbach
30 * @version $Revision: 485242 $
31 * @since mod_jk 1.2.20
33 public class JkStatusResetTask extends AbstractJkStatusTask {
36 * The descriptive information about this implementation.
38 private static final String info = "org.apache.jk.status.JkStatusResetTask/1.1";
40 private String worker;
41 private String loadbalancer;
46 public JkStatusResetTask() {
48 setUrl("http://localhost/jkstatus");
52 * Return descriptive information about this implementation and the
53 * corresponding version number, in the format
54 * <code><description>/<version></code>.
56 public String getInfo() {
63 * @return the loadbalancer
65 public String getLoadbalancer() {
71 * @param loadbalancer the loadbalancer to set
73 public void setLoadbalancer(String loadbalancer) {
74 this.loadbalancer = loadbalancer;
81 public String getWorker() {
87 * @param worker the worker to set
89 public void setWorker(String worker) {
95 * Create jkstatus reset link
97 * <li><b>loadbalancer example:
98 * </b>http://localhost/jkstatus?cmd=reset&mime=txt&w=loadbalancer</li>
99 * <li><b>loadbalancer + sub worker example:
100 * </b>http://localhost/jkstatus?cmd=reset&mime=txt&w=loadbalancer&sw=node01</li>
103 * @return create jkstatus reset link
105 protected StringBuffer createLink() {
107 StringBuffer sb = new StringBuffer();
109 sb.append("?cmd=reset");
110 sb.append("&mime=txt");
112 sb.append(URLEncoder.encode(loadbalancer, getCharset()));
115 sb.append(URLEncoder.encode(worker, getCharset()));
118 } catch (UnsupportedEncodingException e) {
119 throw new BuildException("Invalid 'charset' attribute: "
126 * check correct pararmeter
128 protected void checkParameter() {
129 if (loadbalancer == null) {
130 throw new BuildException("Must specify 'loadbalanacer' attribute");