use of org.apache.catalina.Engine in project tomcat by apache.
the class ThreadLocalLeakPreventionListener method registerListenersForServer.
private void registerListenersForServer(Server server) {
for (Service service : server.findServices()) {
Engine engine = service.getContainer();
engine.addContainerListener(this);
registerListenersForEngine(engine);
}
}
use of org.apache.catalina.Engine in project tomcat by apache.
the class ThreadLocalLeakPreventionListener method processContainerRemoveChild.
protected void processContainerRemoveChild(Container parent, Container child) {
if (log.isDebugEnabled())
log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]");
if (child instanceof Context) {
Context context = (Context) child;
context.removeLifecycleListener(this);
} else if (child instanceof Host || child instanceof Engine) {
child.removeContainerListener(this);
}
}
use of org.apache.catalina.Engine in project tomcat by apache.
the class TesterDigestAuthenticatorPerformance method setUp.
@Before
public void setUp() throws Exception {
ConcurrentMessageDigest.init("MD5");
// Configure the Realm
TesterMapRealm realm = new TesterMapRealm();
realm.addUser(USER, PWD);
realm.addUserRole(USER, ROLE);
// Add the Realm to the Context
Context context = new StandardContext();
context.setName(CONTEXT_PATH);
context.setRealm(realm);
Host host = new StandardHost();
context.setParent(host);
Engine engine = new StandardEngine();
host.setParent(engine);
Service service = new StandardService();
engine.setService(service);
// Configure the Login config
LoginConfig config = new LoginConfig();
config.setRealmName(REALM);
context.setLoginConfig(config);
// Make the Context and Realm visible to the Authenticator
authenticator.setContainer(context);
authenticator.setNonceCountWindowSize(8 * 1024);
authenticator.start();
}
use of org.apache.catalina.Engine in project pinpoint by naver.
the class WebappLoaderStartInterceptor method extractContextKey.
private String extractContextKey(WebappLoader webappLoader) {
final String defaultContextName = "";
try {
Container container = extractContext(webappLoader);
// WebappLoader's associated Container should be a Context.
if (container instanceof Context) {
Context context = (Context) container;
String contextName = context.getName();
Host host = (Host) container.getParent();
Engine engine = (Engine) host.getParent();
StringBuilder sb = new StringBuilder();
sb.append(engine.getName()).append("/").append(host.getName());
if (!contextName.startsWith("/")) {
sb.append('/');
}
sb.append(contextName);
return sb.toString();
}
} catch (Exception e) {
// Same action for any and all exceptions.
logger.warn("Error extracting context name.", e);
}
return defaultContextName;
}
use of org.apache.catalina.Engine in project spring-boot by spring-projects.
the class TomcatWebServer method addInstanceIdToEngineName.
private void addInstanceIdToEngineName() {
int instanceId = containerCounter.incrementAndGet();
if (instanceId > 0) {
Engine engine = this.tomcat.getEngine();
engine.setName(engine.getName() + "-" + instanceId);
}
}
Aggregations