本文整理汇总了Java中org.apache.tomcat.util.IntrospectionUtils.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java IntrospectionUtils.getProperty方法的具体用法?Java IntrospectionUtils.getProperty怎么用?Java IntrospectionUtils.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.util.IntrospectionUtils
的用法示例。
在下文中一共展示了IntrospectionUtils.getProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findProxyConnector
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Find the most likely connector the proxy server should connect to, or
* accept connections from.
*
* @param connectors
* @return
*/
protected Connector findProxyConnector(Connector[] connectors) {
int pos = 0;
int maxThreads = 0;
for (int i = 0; i < connectors.length; i++) {
if (connectors[i].getProtocol().startsWith("AJP")) {
// Return any AJP connector found
return connectors[i];
}
if (Boolean.TRUE.equals(IntrospectionUtils.getProperty(connectors[i].getProtocolHandler(), "reverseConnection"))) {
return connectors[i];
}
Integer mt = (Integer) IntrospectionUtils.getProperty(connectors[i].getProtocolHandler(), "maxThreads");
if (mt.intValue() > maxThreads) {
maxThreads = mt.intValue();
pos = i;
}
}
// If no AJP connector and no reverse, return the connector with the most threads
return connectors[pos];
}
示例2: getProperty
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Return a configured property.
*/
public Object getProperty(String name) {
String repl = name;
if (replacements.get(name) != null) {
repl = replacements.get(name);
}
return IntrospectionUtils.getProperty(protocolHandler, repl);
}
示例3: getProperty
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Return a configured property.
*/
public Object getProperty(String name) {
String repl = name;
if (replacements.get(name) != null) {
repl = (String) replacements.get(name);
}
return IntrospectionUtils.getProperty(protocolHandler, repl);
}
示例4: getAddress
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Return the address on which the connector is bound.
*
* @param connector
* @return
*/
protected String getAddress(Connector connector) {
InetAddress inetAddress =
(InetAddress) IntrospectionUtils.getProperty(connector.getProtocolHandler(), "address");
if (inetAddress == null) {
// Should not happen
return "127.0.0.1";
} else {
return inetAddress.getHostAddress();
}
}
示例5: getProperty
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Return a configured property.
*/
public Object getProperty(String name) {
String repl = name;
if (replacements.get(name) != null) {
repl = replacements.get(name);
}
return IntrospectionUtils.getProperty(protocolHandler, repl);
}
示例6: createObjectName
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>Connector</code> object.
*
* @param domain Domain in which this name is to be created
* @param connector The Connector to be named
*
* @exception MalformedObjectNameException if a name cannot be created
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static ObjectName createObjectName(String domain,
Connector connector)
throws MalformedObjectNameException {
ObjectName name = null;
try {
Object addressObj = IntrospectionUtils.getProperty(connector, "address");
Integer port = (Integer)
IntrospectionUtils.getProperty(connector, "port");
StringBuilder sb = new StringBuilder(domain);
sb.append(":type=Connector");
sb.append(",port=");
sb.append(port);
if (addressObj != null) {
String address = addressObj.toString();
if (address.length() > 0) {
sb.append(",address=");
sb.append(ObjectName.quote(address));
}
}
name = new ObjectName(sb.toString());
return (name);
} catch (Exception e) {
MalformedObjectNameException mone =
new MalformedObjectNameException
("Cannot create object name for " + connector);
mone.initCause(e);
throw mone;
}
}
示例7: createObjectName
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Create an <code>ObjectName</code> for this
* <code>Connector</code> object.
*
* @param domain Domain in which this name is to be created
* @param connector The Connector to be named
*
* @exception MalformedObjectNameException if a name cannot be created
*/
static ObjectName createObjectName(String domain,
Connector connector)
throws MalformedObjectNameException {
ObjectName name = null;
try {
Object addressObj = IntrospectionUtils.getProperty(connector, "address");
Integer port = (Integer)
IntrospectionUtils.getProperty(connector, "port");
StringBuilder sb = new StringBuilder(domain);
sb.append(":type=Connector");
sb.append(",port=");
sb.append(port);
if (addressObj != null) {
String address = addressObj.toString();
if (address.length() > 0) {
sb.append(",address=");
sb.append(ObjectName.quote(address));
}
}
name = new ObjectName(sb.toString());
return (name);
} catch (Exception e) {
MalformedObjectNameException mone =
new MalformedObjectNameException
("Cannot create object name for " + connector);
mone.initCause(e);
throw mone;
}
}
示例8: begin
import org.apache.tomcat.util.IntrospectionUtils; //导入方法依赖的package包/类
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Container c = (Container) digester.peek();
Container p = null;
Object obj = digester.peek(1);
if (obj instanceof Container) {
p = (Container) obj;
}
String className = null;
// Check the container for the specified attribute
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null)
className = value;
}
// Check the container's parent for the specified attribute
if (p != null && className == null) {
String configClass =
(String) IntrospectionUtils.getProperty(p, attributeName);
if (configClass != null && configClass.length() > 0) {
className = configClass;
}
}
// Use the default
if (className == null) {
className = listenerClass;
}
// Instantiate a new LifecyleListener implementation object
Class<?> clazz = Class.forName(className);
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
// Add this LifecycleListener to our associated component
c.addLifecycleListener(listener);
}