本文整理汇总了Java中org.apache.catalina.Service.addConnector方法的典型用法代码示例。如果您正苦于以下问题:Java Service.addConnector方法的具体用法?Java Service.addConnector怎么用?Java Service.addConnector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Service
的用法示例。
在下文中一共展示了Service.addConnector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create a new Connector
*
* @param parent MBean Name of the associated parent component
* @param address The IP address on which to bind
* @param port TCP port number to listen on
* @param isAjp Create a AJP/1.3 Connector
* @param isSSL Create a secure Connector
*
* @exception Exception if an MBean cannot be created or registered
*/
private String createConnector(String parent, String address, int port, boolean isAjp, boolean isSSL)
throws Exception {
Connector retobj = new Connector();
if ((address!=null) && (address.length()>0)) {
retobj.setProperty("address", address);
}
// Set port number
retobj.setPort(port);
// Set the protocol
retobj.setProtocol(isAjp ? "AJP/1.3" : "HTTP/1.1");
// Set SSL
retobj.setSecure(isSSL);
retobj.setScheme(isSSL ? "https" : "http");
// Add the new instance to its parent component
// FIX ME - addConnector will fail
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
service.addConnector(retobj);
// Return the corresponding MBean name
ObjectName coname = retobj.getObjectName();
return (coname.toString());
}
示例2: createConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create a new Connector
*
* @param parent
* MBean Name of the associated parent component
* @param address
* The IP address on which to bind
* @param port
* TCP port number to listen on
* @param isAjp
* Create a AJP/1.3 Connector
* @param isSSL
* Create a secure Connector
*
* @exception Exception
* if an MBean cannot be created or registered
*/
private String createConnector(String parent, String address, int port, boolean isAjp, boolean isSSL)
throws Exception {
Connector retobj = new Connector();
if ((address != null) && (address.length() > 0)) {
retobj.setProperty("address", address);
}
// Set port number
retobj.setPort(port);
// Set the protocol
retobj.setProtocol(isAjp ? "AJP/1.3" : "HTTP/1.1");
// Set SSL
retobj.setSecure(isSSL);
retobj.setScheme(isSSL ? "https" : "http");
// Add the new instance to its parent component
// FIX ME - addConnector will fail
ObjectName pname = new ObjectName(parent);
Service service = getService(pname);
service.addConnector(retobj);
// Return the corresponding MBean name
ObjectName coname = retobj.getObjectName();
return (coname.toString());
}
示例3: createAjpConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create a new AjpConnector
*
* @param parent MBean Name of the associated parent component
* @param address The IP address on which to bind
* @param port TCP port number to listen on
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createAjpConnector(String parent, String address, int port)
throws Exception {
Object retobj = null;
try {
// Create a new CoyoteConnector instance for AJP
// use reflection to avoid j-t-c compile-time circular dependencies
Class cls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
Constructor ct = cls.getConstructor(null);
retobj = ct.newInstance(null);
Class partypes1 [] = new Class[1];
// Set address
String str = new String();
partypes1[0] = str.getClass();
Method meth1 = cls.getMethod("setAddress", partypes1);
Object arglist1[] = new Object[1];
arglist1[0] = address;
meth1.invoke(retobj, arglist1);
// Set port number
Class partypes2 [] = new Class[1];
partypes2[0] = Integer.TYPE;
Method meth2 = cls.getMethod("setPort", partypes2);
Object arglist2[] = new Object[1];
arglist2[0] = new Integer(port);
meth2.invoke(retobj, arglist2);
// set protocolHandlerClassName for AJP
Class partypes3 [] = new Class[1];
partypes3[0] = str.getClass();
Method meth3 = cls.getMethod("setProtocolHandlerClassName", partypes3);
Object arglist3[] = new Object[1];
arglist3[0] = new String("org.apache.jk.server.JkCoyoteHandler");
meth3.invoke(retobj, arglist3);
} catch (Exception e) {
throw new MBeanException(e);
}
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Server server = ServerFactory.getServer();
Service service = server.findService(pname.getKeyProperty("name"));
service.addConnector((Connector)retobj);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("CoyoteConnector");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
return (oname.toString());
}
示例4: createHttpConnector
import org.apache.catalina.Service; //导入方法依赖的package包/类
/**
* Create a new HttpConnector
*
* @param parent MBean Name of the associated parent component
* @param address The IP address on which to bind
* @param port TCP port number to listen on
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createHttpConnector(String parent, String address, int port)
throws Exception {
Object retobj = null;
try {
// Create a new CoyoteConnector instance
// use reflection to avoid j-t-c compile-time circular dependencies
Class cls = Class.forName("org.apache.coyote.tomcat4.CoyoteConnector");
Constructor ct = cls.getConstructor(null);
retobj = ct.newInstance(null);
Class partypes1 [] = new Class[1];
// Set address
String str = new String();
partypes1[0] = str.getClass();
Method meth1 = cls.getMethod("setAddress", partypes1);
Object arglist1[] = new Object[1];
arglist1[0] = address;
meth1.invoke(retobj, arglist1);
// Set port number
Class partypes2 [] = new Class[1];
partypes2[0] = Integer.TYPE;
Method meth2 = cls.getMethod("setPort", partypes2);
Object arglist2[] = new Object[1];
arglist2[0] = new Integer(port);
meth2.invoke(retobj, arglist2);
} catch (Exception e) {
throw new MBeanException(e);
}
// Add the new instance to its parent component
ObjectName pname = new ObjectName(parent);
Server server = ServerFactory.getServer();
Service service = server.findService(pname.getKeyProperty("name"));
service.addConnector((Connector)retobj);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("CoyoteConnector");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), (Connector)retobj);
return (oname.toString());
}