/* * 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.catalina.valves;
/** * Convenience base class for implementations of the <b>Valve</b> interface. A subclass <strong>MUST</strong> implement * an <code>invoke()</code> method to provide the required functionality, and <strong>MAY</strong> implement the * <code>Lifecycle</code> interface to provide configuration management and lifecycle support. * * @author Craig R. McClanahan
*/ publicabstractclass ValveBase extends LifecycleMBeanBase implements Contained, Valve {
protectedstaticfinal StringManager sm = StringManager.getManager(ValveBase.class);
/** * Start this component and implement the requirements of * {@link org.apache.catalina.util.LifecycleBase#startInternal()}. * * @exception LifecycleException if this component detects a fatal error that prevents this component from being * used
*/
@Override protectedsynchronizedvoid startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
/** * Stop this component and implement the requirements of * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. * * @exception LifecycleException if this component detects a fatal error that prevents this component from being * used
*/
@Override protectedsynchronizedvoid stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
}
@Override public String toString() { return ToStringUtil.toString(this);
}
// -------------------- JMX and Registration --------------------
@Override public String getObjectNameKeyProperties() {
StringBuilder name = new StringBuilder("type=Valve");
Container container = getContainer();
name.append(container.getMBeanKeyProperties());
int seq = 0;
// Pipeline may not be present in unit testing
Pipeline p = container.getPipeline(); if (p != null) { for (Valve valve : p.getValves()) { // Skip null valves if (valve == null) { continue;
} // Only compare valves in pipeline until we find this valve if (valve == this) { break;
} if (valve.getClass() == this.getClass()) { // Duplicate valve earlier in pipeline // increment sequence number
seq++;
}
}
}
if (seq > 0) {
name.append(",seq=");
name.append(seq);
}
String className = this.getClass().getName(); int period = className.lastIndexOf('.'); if (period >= 0) {
className = className.substring(period + 1);
}
name.append(",name=");
name.append(className);
return name.toString();
}
@Override public String getDomainInternal() {
Container c = getContainer(); if (c == null) { returnnull;
} else { return c.getDomain();
}
}
}
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.