From 4c1fd34faf705c5e9547dfe11322dfe7381ba3e9 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 14 Feb 2010 23:45:18 +0000 Subject: [PATCH] Use interfaces in o.a.c.startup.Tomcat and update tests as appropriate git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@910123 13f79535-47bb-0310-9956-ffa450edef68 --- .../catalina/startup/LocalStrings.properties | 5 + java/org/apache/catalina/startup/Tomcat.java | 137 +++++++++++++-------- .../catalina/connector/TestKeepAliveCount.java | 4 +- .../org/apache/catalina/connector/TestRequest.java | 6 +- .../apache/catalina/core/TestStandardContext.java | 3 +- .../loader/TestWebappClassLoaderMemoryLeak.java | 11 +- test/org/apache/catalina/startup/TestTomcat.java | 9 +- .../apache/tomcat/util/http/CookiesBaseTest.java | 4 +- .../tomcat/util/http/TestCookiesAllowEquals.java | 4 +- .../tomcat/util/http/TestCookiesAllowHttpSeps.java | 4 +- .../util/http/TestCookiesDisallowEquals.java | 4 +- 11 files changed, 117 insertions(+), 74 deletions(-) diff --git a/java/org/apache/catalina/startup/LocalStrings.properties b/java/org/apache/catalina/startup/LocalStrings.properties index c5db47595..da0620f05 100644 --- a/java/org/apache/catalina/startup/LocalStrings.properties +++ b/java/org/apache/catalina/startup/LocalStrings.properties @@ -108,6 +108,11 @@ tldConfig.webxmlAdd=Adding path [{0}] for URI [{1}] tldConfig.webxmlFail=Failed to process TLD with path [{1}] and URI [{0}] tldConfig.webxmlSkip=Path [{1}] skipped since URI [{0}] is a duplicate tldConfig.webxmlStart=Scanning elements in web.xml +tomcat.addContextNotLifecycle=Tomcat.addContext() was called but the Context implementation does not implement Lifecycle. The functionality provided by the FixContextListener must be provided by other means. +tomcat.addWebappNotLifecycle=Tomcat.addWebapp() was called but the Context implementation does not implement Lifecycle. The functionality provided by the DefaultWebXmlListener and ContextConfig must be provided by other means. +tomcat.namingNotLifecycle=Tomcat.enableNaming() was called but the Server implementation does not implement Lifecycle. The functionality provided by the NamingContextListener must be provided by other means. +tomcat.startNotLifecycle=Tomcat.start() was called but the Server implementation does not implement Lifecycle. The Server must be started by other means. +tomcat.stopNotLifecycle=Tomcat.stop() was called but the Server implementation does not implement Lifecycle. The Server must be stopped by other means. userConfig.database=Exception loading user database userConfig.deploy=Deploying web application for user {0} userConfig.deploying=Deploying user web applications diff --git a/java/org/apache/catalina/startup/Tomcat.java b/java/org/apache/catalina/startup/Tomcat.java index ca256fd3b..e7e6491c3 100644 --- a/java/org/apache/catalina/startup/Tomcat.java +++ b/java/org/apache/catalina/startup/Tomcat.java @@ -31,11 +31,16 @@ import javax.servlet.ServletException; import org.apache.catalina.Container; import org.apache.catalina.Context; +import org.apache.catalina.Engine; +import org.apache.catalina.Host; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Realm; +import org.apache.catalina.Server; +import org.apache.catalina.Service; +import org.apache.catalina.Wrapper; import org.apache.catalina.connector.Connector; import org.apache.catalina.core.NamingContextListener; import org.apache.catalina.core.StandardContext; @@ -47,6 +52,9 @@ import org.apache.catalina.core.StandardWrapper; import org.apache.catalina.realm.GenericPrincipal; import org.apache.catalina.realm.RealmBase; import org.apache.catalina.session.StandardManager; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.res.StringManager; // TODO: lazy init for the temp dir - only when a JSP is compiled or // get temp dir is called we need to create it. This will avoid the @@ -83,16 +91,19 @@ import org.apache.catalina.session.StandardManager; * @author Costin Manolache */ public class Tomcat { + private static final Log log = LogFactory.getLog(Tomcat.class); + private static final StringManager sm = StringManager.getManager(Constants.Package); + // Single engine, service, server, connector - few cases need more, // they can use server.xml - protected StandardServer server; - protected StandardService service; - protected StandardEngine engine; + protected Server server; + protected Service service; + protected Engine engine; protected Connector connector; // for more - customize the classes // To make it a bit easier to config for the common case // ( one host, one context ). - protected StandardHost host; + protected Host host; // TODO: it's easy to add support for more hosts - but is it // really needed ? @@ -154,10 +165,10 @@ public class Tomcat { * * @param contextPath * @param baseDir - * @return new StandardContext + * @return new Context * @throws ServletException */ - public StandardContext addWebapp(String contextPath, + public Context addWebapp(String contextPath, String baseDir) throws ServletException { return addWebapp(getHost(), contextPath, baseDir); @@ -191,7 +202,7 @@ public class Tomcat { * @param baseDir base dir for the context, for static files. Must exist, * relative to the server home */ - public StandardContext addContext(String contextPath, + public Context addContext(String contextPath, String baseDir) { return addContext(getHost(), contextPath, baseDir); } @@ -214,12 +225,11 @@ public class Tomcat { * @param servletClass The class to be used for the Servlet * @return The wrapper for the servlet */ - public StandardWrapper addServlet(String contextPath, + public Wrapper addServlet(String contextPath, String servletName, String servletClass) { Container ctx = getHost().findChild(contextPath); - return addServlet((StandardContext) ctx, - servletName, servletClass); + return addServlet((Context) ctx, servletName, servletClass); } /** @@ -229,11 +239,11 @@ public class Tomcat { * @param servletClass The class to be used for the Servlet * @return The wrapper for the servlet */ - public static StandardWrapper addServlet(StandardContext ctx, + public static Wrapper addServlet(Context ctx, String servletName, String servletClass) { // will do class for name and set init params - StandardWrapper sw = (StandardWrapper)ctx.createWrapper(); + Wrapper sw = ctx.createWrapper(); sw.setServletClass(servletClass); sw.setName(servletName); ctx.addChild(sw); @@ -249,12 +259,11 @@ public class Tomcat { * @param servlet The Servlet to add * @return The wrapper for the servlet */ - public StandardWrapper addServlet(String contextPath, + public Wrapper addServlet(String contextPath, String servletName, Servlet servlet) { Container ctx = getHost().findChild(contextPath); - return addServlet((StandardContext) ctx, - servletName, servlet); + return addServlet((Context) ctx, servletName, servlet); } /** @@ -264,11 +273,11 @@ public class Tomcat { * @param servlet The Servlet to add * @return The wrapper for the servlet */ - public static StandardWrapper addServlet(StandardContext ctx, + public static Wrapper addServlet(Context ctx, String servletName, Servlet servlet) { // will do class for name and set init params - StandardWrapper sw = new ExistingStandardWrapper(servlet); + Wrapper sw = new ExistingStandardWrapper(servlet); sw.setName(servletName); ctx.addChild(sw); @@ -277,22 +286,35 @@ public class Tomcat { /** - * Initialize and start the server. + * Initialize and start the server, assuming that the Server implementation + * implements {@link Lifecycle} (the standard implementation does). If it + * does not, the {@link Server} must be started directly. * @throws LifecycleException */ public void start() throws LifecycleException { getServer(); getConnector(); server.initialize(); - server.start(); + if (server instanceof Lifecycle) { + ((Lifecycle) server).start(); + } else { + log.warn(sm.getString("tomcat.startNotLifecycle")); + } } /** - * Stop the server. + * Stop the server, assuming that the Server implementation implements + * {@link Lifecycle} (the standard implementation does). If it does not, the + * {@link Server} must be stopped directly. * @throws LifecycleException */ public void stop() throws LifecycleException { - getServer().stop(); + getServer(); + if (server instanceof Lifecycle) { + ((Lifecycle) server).stop(); + } else { + log.warn(sm.getString("tomcat.stopNotLifecycle")); + } } @@ -353,7 +375,7 @@ public class Tomcat { * Get the service object. Can be used to add more * connectors and few other global settings. */ - public StandardService getService() { + public Service getService() { getServer(); return service; } @@ -365,11 +387,11 @@ public class Tomcat { * * @param host */ - public void setHost(StandardHost host) { + public void setHost(Host host) { this.host = host; } - public StandardHost getHost() { + public Host getHost() { if (host == null) { host = new StandardHost(); host.setName(hostname); @@ -393,7 +415,7 @@ public class Tomcat { /** * Access to the engine, for further customization. */ - public StandardEngine getEngine() { + public Engine getEngine() { if(engine == null ) { getServer(); engine = new StandardEngine(); @@ -408,7 +430,7 @@ public class Tomcat { * Get the server object. You can add listeners and few more * customizations. JNDI is disabled by default. */ - public StandardServer getServer() { + public Server getServer() { if (server != null) { return server; @@ -427,14 +449,16 @@ public class Tomcat { return server; } - public StandardContext addContext(StandardHost host, - String contextPath, - String dir) { + public Context addContext(Host host, String contextPath, String dir) { silence(contextPath); - StandardContext ctx = new StandardContext(); + Context ctx = new StandardContext(); ctx.setPath( contextPath ); ctx.setDocBase(dir); - ctx.addLifecycleListener(new FixContextListener()); + if (ctx instanceof Lifecycle) { + ((Lifecycle) ctx).addLifecycleListener(new FixContextListener()); + } else { + log.warn(sm.getString("tomcat.addContextNotLifecycle")); + } if (host == null) { getHost().addChild(ctx); @@ -444,23 +468,27 @@ public class Tomcat { return ctx; } - public StandardContext addWebapp(StandardHost host, - String url, String path) { + public Context addWebapp(Host host, String url, String path) { silence(url); - StandardContext ctx = new StandardContext(); + Context ctx = new StandardContext(); ctx.setPath( url ); ctx.setDocBase(path); if (defaultRealm == null) { initSimpleAuth(); } ctx.setRealm(defaultRealm); - ctx.addLifecycleListener(new DefaultWebXmlListener()); - - ContextConfig ctxCfg = new ContextConfig(); - ctx.addLifecycleListener( ctxCfg ); - // prevent it from looking ( if it finds one - it'll have dup error ) - ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML"); + if (ctx instanceof Lifecycle) { + ((Lifecycle) ctx).addLifecycleListener(new DefaultWebXmlListener()); + + ContextConfig ctxCfg = new ContextConfig(); + ((Lifecycle) ctx).addLifecycleListener(ctxCfg); + + // prevent it from looking ( if it finds one - it'll have dup error ) + ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML"); + } else { + log.warn(sm.getString("tomcat.addWebappNotLifecycle")); + } if (host == null) { getHost().addChild(ctx); @@ -572,13 +600,21 @@ public class Tomcat { } /** - * Enables JNDI naming which is disabled by default. + * Enables JNDI naming which is disabled by default. Server must implement + * {@link Lifecycle} in order for the {@link NamingContextListener} to be + * used. + * */ public void enableNaming() { // Make sure getServer() has been called as that is where naming is // disabled getServer(); - server.addLifecycleListener(new NamingContextListener()); + if (server instanceof Lifecycle) { + ((Lifecycle) server).addLifecycleListener( + new NamingContextListener()); + } else { + log.warn(sm.getString("tomcat.namingNotLifecycle")); + } System.setProperty("catalina.useNaming", "true"); @@ -607,23 +643,23 @@ public class Tomcat { * Provide default configuration for a context. This is the programmatic * equivalent of the default web.xml. * - * TODO: in normal tomcat, if default-web.xml is not found, use this + * TODO: in normal Tomcat, if default-web.xml is not found, use this * method * * @param contextPath The context to set the defaults for */ public void initWebappDefaults(String contextPath) { Container ctx = getHost().findChild(contextPath); - initWebappDefaults((StandardContext) ctx); + initWebappDefaults((Context) ctx); } /** * Static version of {@link #initWebappDefaults(String)} * @param ctx The context to set the defaults for */ - public static void initWebappDefaults(StandardContext ctx) { + public static void initWebappDefaults(Context ctx) { // Default servlet - StandardWrapper servlet = addServlet( + Wrapper servlet = addServlet( ctx, "default", "org.apache.catalina.servlets.DefaultServlet"); servlet.setLoadOnStartup(1); @@ -680,15 +716,12 @@ public class Tomcat { /** * Fix reload - required if reloading and using programmatic configuration. * When a context is reloaded, any programmatic configuration is lost. This - * listener sets the equivalent of conf/web.xml when the context starts. The - * context needs to be an instance of StandardContext for this listener to - * have any effect. + * listener sets the equivalent of conf/web.xml when the context starts. */ public static class DefaultWebXmlListener implements LifecycleListener { public void lifecycleEvent(LifecycleEvent event) { - if (Lifecycle.BEFORE_START_EVENT.equals(event.getType()) && - event.getLifecycle() instanceof StandardContext) { - initWebappDefaults((StandardContext) event.getLifecycle()); + if (Lifecycle.BEFORE_START_EVENT.equals(event.getType())) { + initWebappDefaults((Context) event.getLifecycle()); } } } diff --git a/test/org/apache/catalina/connector/TestKeepAliveCount.java b/test/org/apache/catalina/connector/TestKeepAliveCount.java index 00e86bcf0..fd10bb4e6 100644 --- a/test/org/apache/catalina/connector/TestKeepAliveCount.java +++ b/test/org/apache/catalina/connector/TestKeepAliveCount.java @@ -23,7 +23,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.startup.Tomcat; @@ -50,7 +50,7 @@ public class TestKeepAliveCount extends TomcatBaseTest{ if (init) return; Tomcat tomcat = getTomcatInstance(); - StandardContext root = tomcat.addContext("", TEMP_DIR); + Context root = tomcat.addContext("", TEMP_DIR); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); tomcat.getConnector().setProperty("maxKeepAliveRequests", "5"); diff --git a/test/org/apache/catalina/connector/TestRequest.java b/test/org/apache/catalina/connector/TestRequest.java index f96879cde..73a0d72eb 100644 --- a/test/org/apache/catalina/connector/TestRequest.java +++ b/test/org/apache/catalina/connector/TestRequest.java @@ -26,8 +26,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.catalina.Context; import org.apache.catalina.authenticator.BasicAuthenticator; -import org.apache.catalina.core.StandardContext; import org.apache.catalina.deploy.LoginConfig; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.TomcatBaseTest; @@ -125,7 +125,7 @@ public class TestRequest extends TomcatBaseTest { if (init) return; Tomcat tomcat = getTomcatInstance(); - StandardContext root = tomcat.addContext("", TEMP_DIR); + Context root = tomcat.addContext("", TEMP_DIR); Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet()); root.addServletMapping("/test", "Bug37794"); tomcat.start(); @@ -206,7 +206,7 @@ public class TestRequest extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp - StandardContext ctx = + Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); LoginConfig config = new LoginConfig(); diff --git a/test/org/apache/catalina/core/TestStandardContext.java b/test/org/apache/catalina/core/TestStandardContext.java index 6607e2d73..89e9cd722 100644 --- a/test/org/apache/catalina/core/TestStandardContext.java +++ b/test/org/apache/catalina/core/TestStandardContext.java @@ -27,6 +27,7 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; +import org.apache.catalina.Context; import org.apache.catalina.deploy.FilterDef; import org.apache.catalina.deploy.FilterMap; import org.apache.catalina.startup.SimpleHttpClient; @@ -49,7 +50,7 @@ public class TestStandardContext extends TomcatBaseTest { File docBase = new File(tomcat.getHost().getAppBase(), "ROOT"); docBase.mkdirs(); - StandardContext root = tomcat.addContext("", "ROOT"); + Context root = tomcat.addContext("", "ROOT"); // Add test a filter that fails FilterDef filterDef = new FilterDef(); diff --git a/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java b/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java index 52882bd68..5bf75b1b0 100644 --- a/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java +++ b/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java @@ -9,7 +9,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; +import org.apache.catalina.Lifecycle; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; @@ -19,7 +20,7 @@ public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp - StandardContext ctx = + Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); Tomcat.addServlet(ctx, "taskServlet", new TaskServlet()); @@ -31,7 +32,11 @@ public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest { getUrl("http://localhost:" + getPort() + "/"); // Stop the context - ctx.stop(); + if (ctx instanceof Lifecycle) { + ((Lifecycle) ctx).stop(); + } else { + fail("Test requires context implements Lifecycle"); + } // If the thread still exists, we have a thread/memory leak Thread[] threads = getThreads(); diff --git a/test/org/apache/catalina/startup/TestTomcat.java b/test/org/apache/catalina/startup/TestTomcat.java index 40ae2f5d3..612e08e90 100644 --- a/test/org/apache/catalina/startup/TestTomcat.java +++ b/test/org/apache/catalina/startup/TestTomcat.java @@ -34,7 +34,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; import org.apache.catalina.deploy.ContextEnvironment; import org.apache.catalina.deploy.ContextResourceLink; import org.apache.catalina.realm.GenericPrincipal; @@ -169,7 +168,7 @@ public class TestTomcat extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp - StandardContext ctx = + org.apache.catalina.Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); // You can customize the context by calling // its API @@ -230,7 +229,7 @@ public class TestTomcat extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp - StandardContext ctx = + org.apache.catalina.Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); // You can customise the context by calling its API @@ -260,7 +259,7 @@ public class TestTomcat extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // Must have a real docBase - just use temp - StandardContext ctx = + org.apache.catalina.Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); // You can customise the context by calling its API @@ -299,7 +298,7 @@ public class TestTomcat extends TomcatBaseTest { File appDir = new File("output/build/webapps" + contextPath); // app dir is relative to server home - StandardContext ctx = + org.apache.catalina.Context ctx = tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath()); Tomcat.addServlet(ctx, "testGetResource", new GetResource()); diff --git a/test/org/apache/tomcat/util/http/CookiesBaseTest.java b/test/org/apache/tomcat/util/http/CookiesBaseTest.java index 712f9e5eb..2e003dd0a 100644 --- a/test/org/apache/tomcat/util/http/CookiesBaseTest.java +++ b/test/org/apache/tomcat/util/http/CookiesBaseTest.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.startup.Tomcat; @@ -68,7 +68,7 @@ public abstract class CookiesBaseTest extends TomcatBaseTest { public static void addServlets(Tomcat tomcat) { // Must have a real docBase - just use temp - StandardContext ctx = + Context ctx = tomcat.addContext("/", System.getProperty("java.io.tmpdir")); Tomcat.addServlet(ctx, "invalid", new CookieServlet("na;me", "value")); diff --git a/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java b/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java index f58a53d34..2d95a7bdc 100644 --- a/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java +++ b/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.startup.Tomcat; @@ -49,7 +49,7 @@ public class TestCookiesAllowEquals extends TomcatBaseTest{ private void doRequest() throws Exception { Tomcat tomcat = getTomcatInstance(); - StandardContext root = tomcat.addContext("", TEMP_DIR); + Context root = tomcat.addContext("", TEMP_DIR); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); diff --git a/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java b/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java index 28435b972..3331e0fe2 100644 --- a/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java +++ b/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.startup.Tomcat; @@ -47,7 +47,7 @@ public class TestCookiesAllowHttpSeps extends TomcatBaseTest{ private void doRequest() throws Exception { Tomcat tomcat = getTomcatInstance(); - StandardContext root = tomcat.addContext("", TEMP_DIR); + Context root = tomcat.addContext("", TEMP_DIR); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); diff --git a/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java b/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java index 4750892d8..9d6e1e548 100644 --- a/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java +++ b/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.core.StandardContext; +import org.apache.catalina.Context; import org.apache.catalina.startup.SimpleHttpClient; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.catalina.startup.Tomcat; @@ -44,7 +44,7 @@ public class TestCookiesDisallowEquals extends TomcatBaseTest{ private void doRequest() throws Exception { Tomcat tomcat = getTomcatInstance(); - StandardContext root = tomcat.addContext("", TEMP_DIR); + Context root = tomcat.addContext("", TEMP_DIR); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); -- 2.11.0