本文整理汇总了Java中org.apache.catalina.core.StandardEngine类的典型用法代码示例。如果您正苦于以下问题:Java StandardEngine类的具体用法?Java StandardEngine怎么用?Java StandardEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardEngine类属于org.apache.catalina.core包,在下文中一共展示了StandardEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createStandardServiceEngine
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Creates a new StandardService and StandardEngine.
*
* @param domain Domain name for the container instance
* @param defaultHost Name of the default host to be used in the Engine
* @param baseDir Base directory value for Engine
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardServiceEngine(String domain,
String defaultHost, String baseDir) throws Exception{
if (!(container instanceof Server)) {
throw new Exception("Container not Server");
}
StandardEngine engine = new StandardEngine();
engine.setDomain(domain);
engine.setName(domain);
engine.setDefaultHost(defaultHost);
engine.setBaseDir(baseDir);
Service service = new StandardService();
service.setContainer(engine);
service.setName(domain);
((Server) container).addService(service);
return engine.getObjectName().toString();
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:MBeanFactory.java
示例2: lifecycleEvent
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Process the START event for an associated Engine.
*
* @param event The lifecycle event that has occurred
*/
public void lifecycleEvent(LifecycleEvent event) {
// Identify the engine we are associated with
try {
engine = (Engine) event.getLifecycle();
if (engine instanceof StandardEngine) {
int engineDebug = ((StandardEngine) engine).getDebug();
if (engineDebug > this.debug)
this.debug = engineDebug;
}
} catch (ClassCastException e) {
log(sm.getString("engineConfig.cce", event.getLifecycle()), e);
return;
}
// Process the event that has occurred
if (event.getType().equals(Lifecycle.START_EVENT))
start();
else if (event.getType().equals(Lifecycle.STOP_EVENT))
stop();
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:28,代码来源:EngineConfig.java
示例3: createStandardEngine
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Create a new StandardEngine.
*
* @param parent MBean Name of the associated parent component
* @param name Unique name of this Engine
* @param defaultHost Default hostname of this Engine
*
* @exception Exception if an MBean cannot be created or registered
*/
public String createStandardEngine(String parent, String name,
String defaultHost)
throws Exception {
// Create a new StandardEngine instance
StandardEngine engine = new StandardEngine();
engine.setName(name);
engine.setDefaultHost(defaultHost);
// 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.setContainer(engine);
// Return the corresponding MBean name
ManagedBean managed = registry.findManagedBean("StandardEngine");
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), engine);
return (oname.toString());
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:32,代码来源:MBeanFactory.java
示例4: createStandardServiceEngine
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Creates a new StandardService and StandardEngine.
*
* @param domain
* Domain name for the container instance
* @param defaultHost
* Name of the default host to be used in the Engine
* @param baseDir
* Base directory value for Engine
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public String createStandardServiceEngine(String domain, String defaultHost, String baseDir) throws Exception {
if (!(container instanceof Server)) {
throw new Exception("Container not Server");
}
StandardEngine engine = new StandardEngine();
engine.setDomain(domain);
engine.setName(domain);
engine.setDefaultHost(defaultHost);
engine.setBaseDir(baseDir);
Service service = new StandardService();
service.setContainer(engine);
service.setName(domain);
((Server) container).addService(service);
// engine.setService(service);
return engine.getObjectName().toString();
}
开发者ID:how2j,项目名称:lazycat,代码行数:36,代码来源:MBeanFactory.java
示例5: getPort
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
public static int getPort(Host h) {
int port = -1;
StandardHost host = (StandardHost) h;
CatalinaUtil.host = (StandardHost) h;
StandardEngine se = (StandardEngine) host.getParent();
StandardService ss = (StandardService) se.getService();
Connector[] cs = ss.findConnectors();
for (Connector c : cs) {
if (c.getProtocolHandlerClassName().contains("Http11Protocol"))
port = c.getPort();
}
return port;
}
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:CatalinaUtil.java
示例6: testConstructionOfApplicationServerURL
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
@Test(description = "Tests the construction of Application Server URL for a sample request")
public void testConstructionOfApplicationServerURL() {
Request request = new Request();
Connector connector = new Connector();
connector.setProtocol(TestConstants.SSL_PROTOCOL);
connector.setPort(TestConstants.SSL_PORT);
connector.setScheme(TestConstants.SSL_PROTOCOL);
Engine engine = new StandardEngine();
Service service = new StandardService();
engine.setService(service);
engine.getService().addConnector(connector);
Host host = new StandardHost();
host.setName(TestConstants.DEFAULT_TOMCAT_HOST);
request.getMappingData().host = host;
host.setParent(engine);
Optional<String> actual = SSOUtils.constructApplicationServerURL(request);
if (actual.isPresent()) {
Assert.assertEquals(actual.get(), TestConstants.DEFAULT_APPLICATION_SERVER_URL);
} else {
Assert.fail();
}
}
开发者ID:wso2-extensions,项目名称:tomcat-extension-samlsso,代码行数:27,代码来源:SSOUtilsTest.java
示例7: testConstructionOfApplicationServerURLWithNoConnector
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
@Test(description = "Tests the construction of Application Server URL for no SSL/TLS Connector")
public void testConstructionOfApplicationServerURLWithNoConnector() {
Request request = new Request();
Engine engine = new StandardEngine();
Service service = new StandardService();
engine.setService(service);
Host host = new StandardHost();
host.setName(TestConstants.DEFAULT_TOMCAT_HOST);
request.getMappingData().host = host;
host.setParent(engine);
Optional<String> actual = SSOUtils.constructApplicationServerURL(request);
Assert.assertTrue(!actual.isPresent());
}
开发者ID:wso2-extensions,项目名称:tomcat-extension-samlsso,代码行数:17,代码来源:SSOUtilsTest.java
示例8: prepareCatalinaComponents
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
private void prepareCatalinaComponents() {
engine = new StandardEngine();
host = new StandardHost();
fooContext = new StandardContext();
barContext = new StandardContext();
Connector connector = new Connector();
connector.setProtocol(TestConstants.SSL_PROTOCOL);
connector.setPort(TestConstants.SSL_PORT);
connector.setScheme(TestConstants.SSL_PROTOCOL);
Service service = new StandardService();
engine.setService(service);
engine.getService().addConnector(connector);
host.setAppBase(TestConstants.WEB_APP_BASE);
host.setName(TestConstants.DEFAULT_TOMCAT_HOST);
host.setParent(engine);
fooContext.setParent(host);
fooContext.setDocBase(TestConstants.FOO_CONTEXT);
barContext.setParent(host);
barContext.setDocBase(TestConstants.BAR_CONTEXT);
}
开发者ID:wso2-extensions,项目名称:tomcat-extension-samlsso,代码行数:25,代码来源:SAML2SSOManagerTest.java
示例9: build
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
StandardEngine build()
{
StandardEngine engine = new StandardEngine();
engine.setName(name);
engine.setDefaultHost(defaultHost);
engine.setBaseDir(baseDir);
engine.setBackgroundProcessorDelay(backgroundProcessorDelay);
engine.setStartStopThreads(startStopThreads);
engine.setJvmRoute(jvmRoute);
for (HostConfiguration hostConfiguration : hosts)
{
Host host = hostConfiguration.build();
engine.addChild(host);
}
return engine;
}
开发者ID:asaikali,项目名称:tomcat-builder,代码行数:19,代码来源:EngineConfiguration.java
示例10: getDefaultClusterName
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
private static ObjectName getDefaultClusterName(SimpleTcpCluster cluster) throws Exception {
String domain = getMBeanServer().getDefaultDomain();
String type = ":type=";
String clusterType= type+"Cluster";
if (cluster.getContainer() instanceof StandardHost) {
domain = ((StandardHost) cluster.getContainer()).getDomain();
clusterType += ",host=" + cluster.getContainer().getName();
} else {
if (cluster.getContainer() instanceof StandardEngine) {
domain = ((StandardEngine) cluster.getContainer()).getDomain();
}
}
ObjectName clusterName = new ObjectName(domain + clusterType);
return clusterName;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:16,代码来源:ClusterJmxHelper.java
示例11: getBaseDir
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
protected String getBaseDir() {
Container engineC=context.getParent().getParent();
if( engineC instanceof StandardEngine ) {
return ((StandardEngine)engineC).getBaseDir();
}
return System.getProperty(Globals.CATALINA_BASE_PROP);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:ContextConfig.java
示例12: getBaseDir
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
protected String getBaseDir() {
Container engineC=context.getParent().getParent();
if( engineC instanceof StandardEngine ) {
return ((StandardEngine)engineC).getBaseDir();
}
return System.getProperty("catalina.base");
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ContextConfig.java
示例13: createMBeans
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Create the MBeans for the specified Engine and its nested components.
*
* @param engine Engine for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Engine engine) throws Exception {
// Create the MBean for the Engine itself
if (log.isDebugEnabled()) {
log.debug("Creating MBean for Engine " + engine);
}
//MBeanUtils.createMBean(engine);
engine.addContainerListener(this);
if (engine instanceof StandardEngine) {
((StandardEngine) engine).addPropertyChangeListener(this);
}
// Create the MBeans for the associated nested components
Realm eRealm = engine.getRealm();
if (eRealm != null) {
if (log.isDebugEnabled())
log.debug("Creating MBean for Realm " + eRealm);
//MBeanUtils.createMBean(eRealm);
}
// Create the MBeans for each child Host
Container hosts[] = engine.findChildren();
for (int j = 0; j < hosts.length; j++) {
createMBeans((Host) hosts[j]);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:ServerLifecycleListener.java
示例14: createStandardEngineService
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Create a new StandardEngine.
*
* @param parent MBean Name of the associated parent component
* @param engineName Unique name of this Engine
* @param defaultHost Default hostname of this Engine
* @param serviceName Unique name of this Service
*
* @exception Exception if an MBean cannot be created or registered
*/
public Vector createStandardEngineService(String parent,
String engineName, String defaultHost, String serviceName)
throws Exception {
// Create a new StandardService instance
StandardService service = new StandardService();
service.setName(serviceName);
// Create a new StandardEngine instance
StandardEngine engine = new StandardEngine();
engine.setName(engineName);
engine.setDefaultHost(defaultHost);
// Need to set engine before adding it to server in order to set domain
service.setContainer(engine);
// Add the new instance to its parent component
Server server = ServerFactory.getServer();
server.addService(service);
Vector onames = new Vector();
// FIXME service & engine.getObjectName
//ObjectName oname = engine.getObjectName();
ObjectName oname =
MBeanUtils.createObjectName(engineName, engine);
onames.add(0, oname);
//oname = service.getObjectName();
oname =
MBeanUtils.createObjectName(engineName, service);
onames.add(1, oname);
return (onames);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:MBeanFactory.java
示例15: test
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
@Test
public void test() throws Exception {
StandardContext context = new StandardContext();
context.setName("foo");
WebappLoader loader = new WebappLoader() {
@Override
public ClassLoader getClassLoader() {
return WebappLoader.class.getClassLoader();
}
};
context.setLoader(loader);
StandardHost host = new StandardHost();
StandardEngine engine = new StandardEngine();
engine.setService(new StandardService());
host.setParent(engine);
context.setParent(host);
loader.setContext(context);
RedisSessionManager manager = new RedisSessionManager();
manager.setSessionIdGenerator(new StandardSessionIdGenerator());
manager.setContext(context);
manager.initializeSerializer();
manager.initializeDatabaseConnection();
manager.clear();
StandardSession session = manager.createSession(null);
session.setAttribute("foo", "test");
manager.afterRequest();
StandardSession loaded = manager.findSession(session.getId());
Assert.assertEquals(session.getAttribute("foo"), loaded.getAttribute("foo"));
Assert.assertEquals(1, manager.getSize());
Assert.assertArrayEquals(new String[] { session.getId() }, manager.keys());
manager.processExpires();
}
开发者ID:appNG,项目名称:appng-tomcat-session,代码行数:40,代码来源:RedisSessionMangagerIT.java
示例16: getDefaultClusterName
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
private static ObjectName getDefaultClusterName(SimpleTcpCluster cluster) throws Exception {
String domain = getMBeanServer().getDefaultDomain();
String type = ":type=";
String clusterType = type + "Cluster";
if (cluster.getContainer() instanceof StandardHost) {
domain = ((StandardHost) cluster.getContainer()).getDomain();
clusterType += ",host=" + cluster.getContainer().getName();
} else {
if (cluster.getContainer() instanceof StandardEngine) {
domain = ((StandardEngine) cluster.getContainer()).getDomain();
}
}
ObjectName clusterName = new ObjectName(domain + clusterType);
return clusterName;
}
开发者ID:how2j,项目名称:lazycat,代码行数:16,代码来源:ClusterJmxHelper.java
示例17: messageReceived
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* Callback from the cluster, when a message is received, The cluster will
* broadcast it invoking the messageReceived on the receiver.
*
* @param msg
* ClusterMessage - the message received from the cluster
*/
@Override
public void messageReceived(ClusterMessage msg) {
if (msg instanceof SessionIDMessage) {
SessionIDMessage sessionmsg = (SessionIDMessage) msg;
if (log.isDebugEnabled())
log.debug(sm.getString("jvmRoute.receiveMessage.sessionIDChanged", sessionmsg.getOrignalSessionID(),
sessionmsg.getBackupSessionID(), sessionmsg.getContextName()));
Container container = getCluster().getContainer();
Container host = null;
if (container instanceof Engine) {
host = container.findChild(sessionmsg.getHost());
} else {
host = container;
}
if (host != null) {
Context context = (Context) host.findChild(sessionmsg.getContextName());
if (context != null) {
try {
Session session = context.getManager().findSession(sessionmsg.getOrignalSessionID());
if (session != null) {
session.setId(sessionmsg.getBackupSessionID());
} else if (log.isInfoEnabled())
log.info(sm.getString("jvmRoute.lostSession", sessionmsg.getOrignalSessionID(),
sessionmsg.getContextName()));
} catch (IOException e) {
log.error(e);
}
} else if (log.isErrorEnabled())
log.error(sm.getString("jvmRoute.contextNotFound", sessionmsg.getContextName(),
((StandardEngine) host.getParent()).getJvmRoute()));
} else if (log.isErrorEnabled())
log.error(sm.getString("jvmRoute.hostNotFound", sessionmsg.getContextName()));
}
return;
}
开发者ID:how2j,项目名称:lazycat,代码行数:44,代码来源:JvmRouteSessionIDBinderListener.java
示例18: getBaseDir
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
protected String getBaseDir() {
Container engineC = context.getParent().getParent();
if (engineC instanceof StandardEngine) {
return ((StandardEngine) engineC).getBaseDir();
}
return System.getProperty(Globals.CATALINA_BASE_PROP);
}
开发者ID:how2j,项目名称:lazycat,代码行数:8,代码来源:ContextConfig.java
示例19: getStandardContext
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
private StandardContext getStandardContext(ServletContextEvent sce)
throws MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException {
MBeanServer mBeanServer = MBeanServerFactory.findMBeanServer(null).get(0);
ObjectName name = new ObjectName("Catalina", "type", "Server");
Server server = (Server) mBeanServer.getAttribute(name, "managedResource");
StandardEngine engine = (StandardEngine) server.findService("Catalina").getContainer();
Container container = engine.findChild(engine.getDefaultHost());
StandardContext context = (StandardContext) container.findChild(sce.getServletContext().getContextPath());
return context;
}
开发者ID:clstoulouse,项目名称:motu,代码行数:11,代码来源:MotuWebEngineContextListener.java
示例20: setUp
import org.apache.catalina.core.StandardEngine; //导入依赖的package包/类
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
/* set up the manager */
this.manager.setContainer(new StandardContext());
this.manager.getContainer().setName("test");
this.manager.getContainer().setParent(new StandardEngine());
this.manager.getContainer().getParent().setName("parent");
/* create the store */
this.mongoStore = new MongoStore();
this.mongoStore.setHosts("127.0.0.1:27017");
this.mongoStore.setDbName("unitest");
this.mongoStore.setManager(manager);
this.manager.setStore(mongoStore);
/* initialize the store */
this.manager.start();
/* create the test session */
this.testSession = (StandardSession)this.manager.createSession(this.sessionId);
/* add some data */
this.testSession.setAttribute("test", "test", false);
}
开发者ID:HBRGTech,项目名称:mongo-session-manager,代码行数:30,代码来源:MongoStoreTest.java
注:本文中的org.apache.catalina.core.StandardEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论