From 9401f816dd0d9d550fe98a8507224bde51c4b847 Mon Sep 17 00:00:00 2001 From: hongbotian Date: Mon, 30 Nov 2015 02:41:33 -0500 Subject: upload tomcat JIRA: BOTTLENECK-7 Change-Id: I875d474869efd76ca203c30b60ebc0c3ee606d0e Signed-off-by: hongbotian --- .../org/apache/jk/status/JkStatusResetTask.java | 133 +++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 rubbos/app/tomcat-connectors-1.2.32-src/jkstatus/src/share/org/apache/jk/status/JkStatusResetTask.java (limited to 'rubbos/app/tomcat-connectors-1.2.32-src/jkstatus/src/share/org/apache/jk/status/JkStatusResetTask.java') diff --git a/rubbos/app/tomcat-connectors-1.2.32-src/jkstatus/src/share/org/apache/jk/status/JkStatusResetTask.java b/rubbos/app/tomcat-connectors-1.2.32-src/jkstatus/src/share/org/apache/jk/status/JkStatusResetTask.java new file mode 100644 index 00000000..703f04bf --- /dev/null +++ b/rubbos/app/tomcat-connectors-1.2.32-src/jkstatus/src/share/org/apache/jk/status/JkStatusResetTask.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jk.status; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +import org.apache.tools.ant.BuildException; + +/** + * Ant task that implements the /jkstatus?cmd=reset&w=loadbalancer command, supported by the + * mod_jk status (1.2.20) application. + * + * @author Peter Rossbach + * @version $Revision: 485242 $ + * @since mod_jk 1.2.20 + */ +public class JkStatusResetTask extends AbstractJkStatusTask { + + /** + * The descriptive information about this implementation. + */ + private static final String info = "org.apache.jk.status.JkStatusResetTask/1.1"; + + private String worker; + private String loadbalancer; + + /** + * + */ + public JkStatusResetTask() { + super(); + setUrl("http://localhost/jkstatus"); + } + + /** + * Return descriptive information about this implementation and the + * corresponding version number, in the format + * <description>/<version>. + */ + public String getInfo() { + + return (info); + + } + + /** + * @return the loadbalancer + */ + public String getLoadbalancer() { + return loadbalancer; + } + + + /** + * @param loadbalancer the loadbalancer to set + */ + public void setLoadbalancer(String loadbalancer) { + this.loadbalancer = loadbalancer; + } + + + /** + * @return the worker + */ + public String getWorker() { + return worker; + } + + + /** + * @param worker the worker to set + */ + public void setWorker(String worker) { + this.worker = worker; + } + + + /** + * Create jkstatus reset link + * + * + * @return create jkstatus reset link + */ + protected StringBuffer createLink() { + // Building URL + StringBuffer sb = new StringBuffer(); + try { + sb.append("?cmd=reset"); + sb.append("&mime=txt"); + sb.append("&w="); + sb.append(URLEncoder.encode(loadbalancer, getCharset())); + if(worker != null) { + sb.append("&sw="); + sb.append(URLEncoder.encode(worker, getCharset())); + } + + } catch (UnsupportedEncodingException e) { + throw new BuildException("Invalid 'charset' attribute: " + + getCharset()); + } + return sb; + } + + /** + * check correct pararmeter + */ + protected void checkParameter() { + if (loadbalancer == null) { + throw new BuildException("Must specify 'loadbalanacer' attribute"); + } + } +} \ No newline at end of file -- cgit 1.2.3-korg