本文整理汇总了Java中org.apache.catalina.Valve类的典型用法代码示例。如果您正苦于以下问题:Java Valve类的具体用法?Java Valve怎么用?Java Valve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Valve类属于org.apache.catalina包,在下文中一共展示了Valve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValveObjectNames
import org.apache.catalina.Valve; //导入依赖的package包/类
public ObjectName[] getValveObjectNames() {
ArrayList<ObjectName> valveList = new ArrayList<ObjectName>();
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof ValveBase) {
valveList.add(((ValveBase) current).getObjectName());
}
current = current.getNext();
}
return valveList.toArray(new ObjectName[0]);
}
示例2: createValve
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Create a new Valve and associate it with a {@link Container}.
*
* @param className
* The fully qualified class name of the {@link Valve} to create
* @param parent
* The MBean name of the associated parent {@link Container}.
*
* @return The MBean name of the {@link Valve} that was created or
* <code>null</code> if the {@link Valve} does not implement
* {@link LifecycleMBeanBase}.
*/
public String createValve(String className, String parent) throws Exception {
// Look for the parent
ObjectName parentName = new ObjectName(parent);
Container container = getParentContainerFromParent(parentName);
if (container == null) {
// TODO
throw new IllegalArgumentException();
}
Valve valve = (Valve) Class.forName(className).newInstance();
container.getPipeline().addValve(valve);
if (valve instanceof LifecycleMBeanBase) {
return ((LifecycleMBeanBase) valve).getObjectName().toString();
} else {
return null;
}
}
示例3: destroyMBean
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Valve</code> object.
*
* @param valve The Valve to be managed
*
* @exception Exception if an MBean cannot be deregistered
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static void destroyMBean(Valve valve, Container container)
throws Exception {
((Contained)valve).setContainer(container);
String mname = createManagedName(valve);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, valve);
try {
((Contained)valve).setContainer(null);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
}
if( mserver.isRegistered(oname) ) {
mserver.unregisterMBean(oname);
}
}
示例4: stopInternal
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Stop {@link Valve}s) in this pipeline and implement the requirements
* of {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
// Stop the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).stop();
current = current.getNext();
}
}
示例5: startInternal
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Start {@link Valve}s) in this pipeline and implement the requirements of
* {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException
* if this component detects a fatal error that prevents this
* component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
// Start the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).start();
current = current.getNext();
}
setState(LifecycleState.STARTING);
}
示例6: getValves
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Return the set of Valves in the pipeline associated with this
* Container, including the basic Valve (if any). If there are no
* such Valves, a zero-length array is returned.
*/
@Override
public Valve[] getValves() {
ArrayList<Valve> valveList = new ArrayList<Valve>();
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
valveList.add(current);
current = current.getNext();
}
return valveList.toArray(new Valve[0]);
}
示例7: getValveObjectNames
import org.apache.catalina.Valve; //导入依赖的package包/类
public ObjectName[] getValveObjectNames() {
ArrayList<ObjectName> valveList = new ArrayList<ObjectName>();
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof ValveBase) {
valveList.add(((ValveBase) current).getObjectName());
}
current = current.getNext();
}
return valveList.toArray(new ObjectName[0]);
}
示例8: stopInternal
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Stop {@link Valve}s) in this pipeline and implement the requirements of
* {@link LifecycleBase#stopInternal()}.
*
* @exception LifecycleException
* if this component detects a fatal error that prevents this
* component from being used
*/
@Override
protected synchronized void stopInternal() throws LifecycleException {
setState(LifecycleState.STOPPING);
// Stop the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).stop();
current = current.getNext();
}
}
示例9: getAuthenticator
import org.apache.catalina.Valve; //导入依赖的package包/类
@Override
public Authenticator getAuthenticator() {
if (this instanceof Authenticator)
return (Authenticator) this;
Pipeline pipeline = getPipeline();
if (pipeline != null) {
Valve basic = pipeline.getBasic();
if ((basic != null) && (basic instanceof Authenticator))
return (Authenticator) basic;
Valve valves[] = pipeline.getValves();
for (int i = 0; i < valves.length; i++) {
if (valves[i] instanceof Authenticator)
return (Authenticator) valves[i];
}
}
return null;
}
示例10: getAccessLog
import org.apache.catalina.Valve; //导入依赖的package包/类
@Override
public AccessLog getAccessLog() {
if (accessLogScanComplete) {
return accessLog;
}
AccessLogAdapter adapter = null;
Valve valves[] = getPipeline().getValves();
for (Valve valve : valves) {
if (valve instanceof AccessLog) {
if (adapter == null) {
adapter = new AccessLogAdapter((AccessLog) valve);
} else {
adapter.add((AccessLog) valve);
}
}
}
if (adapter != null) {
accessLog = adapter;
}
accessLogScanComplete = true;
return accessLog;
}
示例11: destroyMBean
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Valve</code> object.
*
* @param valve The Valve to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(Valve valve, Container container)
throws Exception {
((Contained)valve).setContainer(container);
String mname = createManagedName(valve);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, valve);
try {
((Contained)valve).setContainer(null);
} catch (Throwable t) {
;
}
if( mserver.isRegistered(oname) ) {
mserver.unregisterMBean(oname);
}
}
示例12: getValves
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Return the set of Valves in the pipeline associated with this
* Container, including the basic Valve (if any). If there are no
* such Valves, a zero-length array is returned.
*/
public Valve[] getValves() {
ArrayList valveList = new ArrayList();
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
valveList.add(current);
current = current.getNext();
}
return ((Valve[]) valveList.toArray(new Valve[0]));
}
示例13: getValveObjectNames
import org.apache.catalina.Valve; //导入依赖的package包/类
public ObjectName[] getValveObjectNames() {
ArrayList valveList = new ArrayList();
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof ValveBase) {
valveList.add(((ValveBase) current).getObjectName());
}
current = current.getNext();
}
return ((ObjectName[]) valveList.toArray(new ObjectName[0]));
}
示例14: destroyMBean
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Deregister the MBean for this <code>Valve</code> object.
*
* @param valve
* The Valve to be managed
*
* @exception Exception
* if an MBean cannot be deregistered
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static void destroyMBean(Valve valve, Container container) throws Exception {
((Contained) valve).setContainer(container);
String mname = createManagedName(valve);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, valve);
try {
((Contained) valve).setContainer(null);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
}
if (mserver.isRegistered(oname)) {
mserver.unregisterMBean(oname);
}
}
示例15: getValves
import org.apache.catalina.Valve; //导入依赖的package包/类
/**
* Return the MBean Names of the Valves assoicated with this Host
*
* @exception Exception if an MBean cannot be created or registered
*/
public String [] getValves()
throws Exception {
Registry registry = MBeanUtils.createRegistry();
StandardHost host = (StandardHost) this.resource;
String mname = MBeanUtils.createManagedName(host);
ManagedBean managed = registry.findManagedBean(mname);
String domain = null;
if (managed != null) {
domain = managed.getDomain();
}
if (domain == null)
domain = mserver.getDefaultDomain();
Valve [] valves = host.getValves();
String [] mbeanNames = new String[valves.length];
for (int i = 0; i < valves.length; i++) {
mbeanNames[i] =
MBeanUtils.createObjectName(domain, valves[i]).toString();
}
return mbeanNames;
}