本文整理汇总了Java中org.apache.catalina.Engine类的典型用法代码示例。如果您正苦于以下问题:Java Engine类的具体用法?Java Engine怎么用?Java Engine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Engine类属于org.apache.catalina包,在下文中一共展示了Engine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateSessionTrackingModes
import org.apache.catalina.Engine; //导入依赖的package包/类
private void populateSessionTrackingModes() {
// URL re-writing is always enabled by default
defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
supportedSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
if (context.getCookies()) {
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
supportedSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
// SSL not enabled by default as it can only used on its own
// Context > Host > Engine > Service
Service s = ((Engine) context.getParent().getParent()).getService();
Connector[] connectors = s.findConnectors();
// Need at least one SSL enabled connector to use the SSL session ID.
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
break;
}
}
}
示例2: configBase
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Return a File object representing the "configuration root" directory
* for our associated Host.
*/
protected File configBase() {
if (configBase != null) {
return configBase;
}
if (host.getXmlBase()!=null) {
configBase = returnCanonicalPath(host.getXmlBase());
} else {
StringBuilder xmlDir = new StringBuilder("conf");
Container parent = host.getParent();
if (parent instanceof Engine) {
xmlDir.append('/');
xmlDir.append(parent.getName());
}
xmlDir.append('/');
xmlDir.append(host.getName());
configBase = returnCanonicalPath(xmlDir.toString());
}
return (configBase);
}
示例3: startInternal
import org.apache.catalina.Engine; //导入依赖的package包/类
@Override
public void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
// Find any components that have already been initialized since the
// MBean listener won't be notified as those components will have
// already registered their MBeans
findDefaultHost();
Engine engine = (Engine) connector.getService().getContainer();
addListeners(engine);
Container[] conHosts = engine.findChildren();
for (Container conHost : conHosts) {
Host host = (Host) conHost;
if (!LifecycleState.NEW.equals(host.getState())) {
// Registering the host will register the context and wrappers
registerHost(host);
}
}
}
示例4: lifecycleEvent
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Process the START event for an associated Engine.
*
* @param event The lifecycle event that has occurred
*/
@Override
public void lifecycleEvent(LifecycleEvent event) {
// Identify the engine we are associated with
try {
engine = (Engine) event.getLifecycle();
} catch (ClassCastException e) {
log.error(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();
}
示例5: startInternal
import org.apache.catalina.Engine; //导入依赖的package包/类
@Override
public void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
// Find any components that have already been initialized since the
// MBean listener won't be notified as those components will have
// already registered their MBeans
findDefaultHost();
Engine engine = (Engine) connector.getService().getContainer();
addListeners(engine);
Container[] conHosts = engine.findChildren();
for (Container conHost : conHosts) {
Host host = (Host) conHost;
if (!LifecycleState.NEW.equals(host.getState())) {
// Registering the host will register the context and wrappers
registerHost(host);
}
}
}
示例6: getDomain
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Determine the name of the domain to register MBeans for from a given
* Container.
*
* @param container
*
* @deprecated To be removed since to creates a circular dependency. Will
* be replaced in Tomcat 8 by a new method on {@link
* Container}.
*/
@Deprecated
public static String getDomain(Container container) {
String domain = null;
Container c = container;
while (!(c instanceof Engine) && c != null) {
c = c.getParent();
}
if (c != null) {
domain = c.getName();
}
return domain;
}
示例7: getServer
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Return the Server object that is the ultimate parent for the container
* with which this Realm is associated. If the server cannot be found (eg
* because the container hierarchy is not complete), <code>null</code> is
* returned.
*/
protected Server getServer() {
Container c = container;
if (c instanceof Context) {
c = c.getParent();
}
if (c instanceof Host) {
c = c.getParent();
}
if (c instanceof Engine) {
Service s = ((Engine) c).getService();
if (s != null) {
return s.getServer();
}
}
return null;
}
示例8: getServer
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Return the Server object that is the ultimate parent for the container
* with which this Realm is associated. If the server cannot be found (eg
* because the container hierarchy is not complete), <code>null</code> is
* returned.
*/
protected Server getServer() {
Container c = container;
if (c instanceof Context) {
c = c.getParent();
}
if (c instanceof Host) {
c = c.getParent();
}
if (c instanceof Engine) {
Service s = ((Engine)c).getService();
if (s != null) {
return s.getServer();
}
}
return null;
}
示例9: populateSessionTrackingModes
import org.apache.catalina.Engine; //导入依赖的package包/类
private void populateSessionTrackingModes() {
// URL re-writing is always enabled by default
defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
supportedSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
if (context.getCookies()) {
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
supportedSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
// SSL not enabled by default as it can only used on its own
// Context > Host > Engine > Service
Service s = ((Engine) context.getParent().getParent()).getService();
Connector[] connectors = s.findConnectors();
// Need at least one SSL enabled connector to use the SSL session ID.
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
break;
}
}
}
示例10: getConfigBaseFile
import org.apache.catalina.Engine; //导入依赖的package包/类
private static File getConfigBaseFile(Host host) {
String path = null;
if (host.getXmlBase() != null) {
path = host.getXmlBase();
} else {
StringBuilder xmlDir = new StringBuilder("conf");
Container parent = host.getParent();
if (parent instanceof Engine) {
xmlDir.append('/');
xmlDir.append(parent.getName());
}
xmlDir.append('/');
xmlDir.append(host.getName());
path = xmlDir.toString();
}
return getCanonicalPath(path);
}
示例11: addEngine
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Add a new Engine to the set of defined Engines.
*
* @param engine The engine to be added
*/
public synchronized void addEngine(Engine engine) {
if( log.isDebugEnabled() )
log.debug("Adding engine (" + engine.getInfo() + ")");
// Add this Engine to our set of defined Engines
Engine results[] = new Engine[engines.length + 1];
for (int i = 0; i < engines.length; i++)
results[i] = engines[i];
results[engines.length] = engine;
engines = results;
// Start this Engine if necessary
if (started && (engine instanceof Lifecycle)) {
try {
((Lifecycle) engine).start();
} catch (LifecycleException e) {
log.error("Engine.start", e);
}
}
this.container = engine;
}
示例12: getHostConfigPath
import org.apache.catalina.Engine; //导入依赖的package包/类
protected String getHostConfigPath(String resourceName) {
StringBuffer result = new StringBuffer();
Container container = context;
Container host = null;
Container engine = null;
while (container != null) {
if (container instanceof Host)
host = container;
if (container instanceof Engine)
engine = container;
container = container.getParent();
}
if (engine != null) {
result.append(engine.getName()).append('/');
}
if (host != null) {
result.append(host.getName()).append('/');
}
result.append(resourceName);
return result.toString();
}
示例13: lifecycleEvent
import org.apache.catalina.Engine; //导入依赖的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();
} catch (ClassCastException e) {
log.error(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();
}
示例14: createMBeans
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Create the MBeans for the specified Service and its nested components.
*
* @param service Service for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Service service) throws Exception {
// Create the MBean for the Service itself
if (log.isDebugEnabled())
log.debug("Creating MBean for Service " + service);
//MBeanUtils.createMBean(service);
if (service instanceof StandardService) {
((StandardService) service).addPropertyChangeListener(this);
}
// Create the MBeans for the corresponding Connectors
Connector connectors[] = service.findConnectors();
for (int j = 0; j < connectors.length; j++) {
createMBeans(connectors[j]);
}
// Create the MBean for the associated Engine and friends
Engine engine = (Engine) service.getContainer();
if (engine != null) {
createMBeans(engine);
}
}
示例15: destroyMBeans
import org.apache.catalina.Engine; //导入依赖的package包/类
/**
* Deregister the MBeans for the specified Service and its nested
* components.
*
* @param service Service for which to destroy MBeans
*
* @exception Exception if an exception is thrown during MBean destruction
*/
protected void destroyMBeans(Service service) throws Exception {
// Deregister the MBeans for the associated Engine
Engine engine = (Engine) service.getContainer();
if (engine != null) {
//destroyMBeans(engine);
}
// // Deregister the MBeans for the corresponding Connectors
// Connector connectors[] = service.findConnectors();
// for (int j = 0; j < connectors.length; j++) {
// destroyMBeans(connectors[j], service);
// }
// Deregister the MBean for the Service itself
if (log.isDebugEnabled()) {
log.debug("Destroying MBean for Service " + service);
}
//MBeanUtils.destroyMBean(service);
if (service instanceof StandardService) {
((StandardService) service).removePropertyChangeListener(this);
}
}