diff --git java/org/apache/catalina/core/StandardContext.java java/org/apache/catalina/core/StandardContext.java index 52293c4..ec1413c 100644 --- java/org/apache/catalina/core/StandardContext.java +++ java/org/apache/catalina/core/StandardContext.java @@ -120,6 +120,7 @@ import org.apache.juli.logging.LogFactory; import org.apache.naming.ContextBindings; import org.apache.naming.resources.BaseDirContext; import org.apache.naming.resources.DirContextURLStreamHandler; +import org.apache.naming.resources.EmptyDirContext; import org.apache.naming.resources.FileDirContext; import org.apache.naming.resources.ProxyDirContext; import org.apache.naming.resources.WARDirContext; @@ -5316,7 +5317,9 @@ public class StandardContext extends ContainerBase if (log.isDebugEnabled()) log.debug("Configuring default Resources"); try { - if ((getDocBase() != null) && (getDocBase().endsWith(".war")) && + if (getDocBase() == null) + setResources(new EmptyDirContext()); + else if ((getDocBase() != null) && (getDocBase().endsWith(".war")) && (!(new File(getBasePath())).isDirectory())) setResources(new WARDirContext()); else diff --git java/org/apache/naming/resources/EmptyDirContext.java java/org/apache/naming/resources/EmptyDirContext.java new file mode 100644 index 0000000..153c81a --- /dev/null +++ java/org/apache/naming/resources/EmptyDirContext.java @@ -0,0 +1,403 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.naming.resources; + +import javax.naming.Binding; +import javax.naming.CompositeName; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameNotFoundException; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.ModificationItem; +import javax.naming.directory.SearchControls; +import javax.naming.directory.SearchResult; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +/** + * A {@link DirContext} implementation that is not backed by a file system + * and behaves as if it has no resources available. This is primarily used in + * embedded mode when the web application is configured entirely + * programmatically and does not use any static resources from the file system. + * EmptyDirContext is implemented as a read only context. + * + * @author Huxing Zhang (huxing.zhx@alibaba-inc.com) + */ +public class EmptyDirContext implements DirContext { + + /** + * Static field to avoid useless object creation + */ + private static final Attributes emptyAttributes = new BasicAttributes(); + + private static final NameNotFoundException nameNotFoundException = new NameNotFoundException(); + + private static final Name emptyName = new CompositeName(); + + private static final Hashtable emptyEnv = new Hashtable(); + + private static final String emptyString = ""; + + /** + * Non-static field to avoid useless object creation + */ + private final NamingEnumeration emptyEnum = new EmptyNamingEnumImpl(); + + private final NameParser nameParser = new NameParserImpl(); + + @Override + public Attributes getAttributes(Name name) throws NamingException { + return emptyAttributes; + } + + @Override + public Attributes getAttributes(String name) throws NamingException { + return emptyAttributes; + } + + @Override + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException { + return emptyAttributes; + } + + @Override + public Attributes getAttributes(String name, String[] attrIds) throws NamingException { + return emptyAttributes; + } + + @Override + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException { + // no op + } + + @Override + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException { + // no op + } + + @Override + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException { + // no op + } + + @Override + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException { + // no op + } + + @Override + public void bind(Name name, Object obj, Attributes attrs) throws NamingException { + // no op + } + + @Override + public void bind(String name, Object obj, Attributes attrs) throws NamingException { + // no op + } + + @Override + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException { + // no op + } + + @Override + public void rebind(String name, Object obj, Attributes attrs) throws NamingException { + // no op + } + + @Override + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException { + return this; + } + + @Override + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException { + return this; + } + + @Override + public DirContext getSchema(Name name) throws NamingException { + return this; + } + + @Override + public DirContext getSchema(String name) throws NamingException { + return this; + } + + @Override + public DirContext getSchemaClassDefinition(Name name) throws NamingException { + return this; + } + + @Override + public DirContext getSchemaClassDefinition(String name) throws NamingException { + return this; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(Name name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(String name, Attributes matchingAttributes, + String[] attributesToReturn) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(Name name, Attributes matchingAttributes) + throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(String name, Attributes matchingAttributes) + throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(Name name, String filter, SearchControls cons) + throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(String name, String filter, SearchControls cons) + throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(Name name, String filterExpr, + Object[] filterArgs, SearchControls cons) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration search(String name, String filterExpr, + Object[] filterArgs, SearchControls cons) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + public Object lookup(Name name) throws NamingException { + throw nameNotFoundException; + } + + @Override + public Object lookup(String name) throws NamingException { + throw nameNotFoundException; + } + + @Override + public void bind(Name name, Object obj) throws NamingException { + // no op + } + + @Override + public void bind(String name, Object obj) throws NamingException { + // no op + } + + @Override + public void rebind(Name name, Object obj) throws NamingException { + // no op + } + + @Override + public void rebind(String name, Object obj) throws NamingException { + // no op + } + + @Override + public void unbind(Name name) throws NamingException { + // no op + } + + @Override + public void unbind(String name) throws NamingException { + // no op + } + + @Override + public void rename(Name oldName, Name newName) throws NamingException { + // no op + } + + @Override + public void rename(String oldName, String newName) throws NamingException { + // no op + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration list(Name name) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration list(String name) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration listBindings(Name name) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + @SuppressWarnings("unchecked") + public NamingEnumeration listBindings(String name) throws NamingException { + return (NamingEnumeration) emptyEnum; + } + + @Override + public void destroySubcontext(Name name) throws NamingException { + // no op + } + + @Override + public void destroySubcontext(String name) throws NamingException { + // no op + } + + @Override + public Context createSubcontext(Name name) throws NamingException { + return this; + } + + @Override + public Context createSubcontext(String name) throws NamingException { + return this; + } + + @Override + public Object lookupLink(Name name) throws NamingException { + throw nameNotFoundException; + } + + @Override + public Object lookupLink(String name) throws NamingException { + throw nameNotFoundException; + } + + @Override + public NameParser getNameParser(Name name) throws NamingException { + return nameParser; + } + + @Override + public NameParser getNameParser(String name) throws NamingException { + return nameParser; + } + + @Override + public Name composeName(Name name, Name prefix) throws NamingException { + return emptyName; + } + + @Override + public String composeName(String name, String prefix) throws NamingException { + return emptyString; + } + + @Override + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + return null; + } + + @Override + public Object removeFromEnvironment(String propName) throws NamingException { + return null; + } + + @Override + public Hashtable getEnvironment() throws NamingException { + return emptyEnv; + } + + @Override + public void close() throws NamingException { + // NO OP + } + + @Override + public String getNameInNamespace() throws NamingException { + return emptyString; + } + + class EmptyNamingEnumImpl implements NamingEnumeration { + + Enumeration elements = new Vector().elements(); + + @Override + public T next() throws NamingException { + return nextElement(); + } + + @Override + public boolean hasMore() throws NamingException { + return hasMoreElements(); + } + + @Override + public void close() throws NamingException { + elements = null; + } + + @Override + public boolean hasMoreElements() { + return elements.hasMoreElements(); + } + + @Override + public T nextElement() { + return elements.nextElement(); + } + } + + class NameParserImpl implements NameParser { + + @Override + public Name parse(String name) throws NamingException { + return emptyName; + } + } + +} \ No newline at end of file diff --git test/javax/servlet/http/TestHttpServlet.java test/javax/servlet/http/TestHttpServlet.java index 7baf3e8..2190baa 100644 --- test/javax/servlet/http/TestHttpServlet.java +++ test/javax/servlet/http/TestHttpServlet.java @@ -38,9 +38,9 @@ public class TestHttpServlet extends TomcatBaseTest { public void testBug53454() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp + // No file system docBase required StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + tomcat.addContext("", null); // Map the test Servlet LargeBodyServlet largeBodyServlet = new LargeBodyServlet(); @@ -82,8 +82,7 @@ public class TestHttpServlet extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // No file system docBase required - StandardContext ctx = (StandardContext) tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + StandardContext ctx = (StandardContext) tomcat.addContext("", null); Bug57602ServletOuter outer = new Bug57602ServletOuter(); Tomcat.addServlet(ctx, "Bug57602ServletOuter", outer); diff --git test/org/apache/catalina/authenticator/TestDigestAuthenticator.java test/org/apache/catalina/authenticator/TestDigestAuthenticator.java index 0f08226..f8e5ccc 100644 --- test/org/apache/catalina/authenticator/TestDigestAuthenticator.java +++ test/org/apache/catalina/authenticator/TestDigestAuthenticator.java @@ -269,9 +269,8 @@ public class TestDigestAuthenticator extends TomcatBaseTest { // Configure a context with digest auth and a single protected resource Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext(CONTEXT_PATH, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext(CONTEXT_PATH, null); // Add protected servlet Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet()); diff --git test/org/apache/catalina/authenticator/TestFormAuthenticator.java test/org/apache/catalina/authenticator/TestFormAuthenticator.java index 434e151..59915ad 100644 --- test/org/apache/catalina/authenticator/TestFormAuthenticator.java +++ test/org/apache/catalina/authenticator/TestFormAuthenticator.java @@ -656,8 +656,8 @@ public class TestFormAuthenticator extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - Context ctx = tomcat.addContext( - "", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "SelectedMethods", new SelectedMethodsServlet()); ctx.addServletMapping("/test", "SelectedMethods"); diff --git test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java index 79f5482..c710e90 100644 --- test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java +++ test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java @@ -505,9 +505,8 @@ public class TestNonLoginAndBasicAuthenticator extends TomcatBaseTest { private void setUpNonLogin() throws Exception { - // Must have a real docBase for webapps - just use temp - nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null); nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS); // Add protected servlet to the context @@ -542,9 +541,8 @@ public class TestNonLoginAndBasicAuthenticator extends TomcatBaseTest { private void setUpLogin() throws Exception { - // Must have a real docBase for webapps - just use temp - basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, null); basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS); // Add protected servlet to the context diff --git test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java index 65aca3d..327da18 100644 --- test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java +++ test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java @@ -479,9 +479,8 @@ public class TestSSOnonLoginAndBasicAuthenticator extends TomcatBaseTest { private void setUpNonLogin() throws Exception { - // Must have a real docBase for webapps - just use temp - nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null); nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS); // Add protected servlet to the context @@ -518,9 +517,8 @@ public class TestSSOnonLoginAndBasicAuthenticator extends TomcatBaseTest { private void setUpLogin() throws Exception { - // Must have a real docBase for webapps - just use temp - basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, null); basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS); // Add protected servlet to the context diff --git test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java index 4ced4e7..d02fe6c 100644 --- test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java +++ test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java @@ -329,9 +329,8 @@ public class TestSSOnonLoginAndDigestAuthenticator extends TomcatBaseTest { private void setUpNonLogin(Tomcat tomcat) throws Exception { - // Must have a real docBase for webapps - just use temp - Context ctxt = tomcat.addContext(CONTEXT_PATH_NOLOGIN, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null); ctxt.setSessionTimeout(LONG_TIMEOUT_SECS); // Add protected servlet @@ -363,9 +362,8 @@ public class TestSSOnonLoginAndDigestAuthenticator extends TomcatBaseTest { private void setUpDigest(Tomcat tomcat) throws Exception { - // Must have a real docBase for webapps - just use temp - Context ctxt = tomcat.addContext(CONTEXT_PATH_DIGEST, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext(CONTEXT_PATH_DIGEST, null); ctxt.setSessionTimeout(SHORT_TIMEOUT_SECS); // Add protected servlet diff --git test/org/apache/catalina/comet/TestCometProcessor.java test/org/apache/catalina/comet/TestCometProcessor.java index fdc2aee..9d7a079 100644 --- test/org/apache/catalina/comet/TestCometProcessor.java +++ test/org/apache/catalina/comet/TestCometProcessor.java @@ -57,7 +57,8 @@ public class TestCometProcessor extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "comet", new SimpleCometServlet()); root.addServletMapping("/comet", "comet"); Tomcat.addServlet(root, "hello", new HelloWorldServlet()); @@ -124,7 +125,8 @@ public class TestCometProcessor extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "comet", new CometCloseServlet()); root.addServletMapping("/comet", "comet"); Tomcat.addServlet(root, "hello", new HelloWorldServlet()); @@ -195,7 +197,8 @@ public class TestCometProcessor extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "comet", new ConnectionCloseServlet()); root.addServletMapping("/comet", "comet"); Tomcat.addServlet(root, "hello", new HelloWorldServlet()); @@ -268,7 +271,8 @@ public class TestCometProcessor extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Wrapper w = Tomcat.addServlet(root, "comet", new SimpleCometServlet()); if (initParam != null) { w.addInitParameter(initParam, "true"); @@ -363,7 +367,8 @@ public class TestCometProcessor extends TomcatBaseTest { // Setup Tomcat instance SimpleCometServlet servlet = new SimpleCometServlet(); Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "comet", servlet); root.addServletMapping("/", "comet"); tomcat.start(); diff --git test/org/apache/catalina/connector/TestConnector.java test/org/apache/catalina/connector/TestConnector.java index 0006ce3..146667c 100644 --- test/org/apache/catalina/connector/TestConnector.java +++ test/org/apache/catalina/connector/TestConnector.java @@ -39,7 +39,8 @@ public class TestConnector extends TomcatBaseTest { public void testStop() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Wrapper w = Tomcat.addServlet(root, "tester", new TesterServlet()); w.setAsyncSupported(true); diff --git test/org/apache/catalina/connector/TestCoyoteAdapter.java test/org/apache/catalina/connector/TestCoyoteAdapter.java index 02d933f..2be99b9 100644 --- test/org/apache/catalina/connector/TestCoyoteAdapter.java +++ test/org/apache/catalina/connector/TestCoyoteAdapter.java @@ -131,9 +131,8 @@ public class TestCoyoteAdapter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new PathParamServlet()); ctx.addServletMapping("/", "servlet"); @@ -185,9 +184,8 @@ public class TestCoyoteAdapter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("/testapp", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("/testapp", null); Tomcat.addServlet(ctx, "servlet", new PathParamServlet()); ctx.addServletMapping("*.txt", "servlet"); @@ -236,9 +234,8 @@ public class TestCoyoteAdapter extends TomcatBaseTest { tomcat.getConnector().setURIEncoding(encoding); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); PathInfoServlet servlet = new PathInfoServlet(); Tomcat.addServlet(ctx, "servlet", servlet); @@ -278,9 +275,8 @@ public class TestCoyoteAdapter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncServlet servlet = new AsyncServlet(); Wrapper w = Tomcat.addServlet(ctx, "async", servlet); diff --git test/org/apache/catalina/connector/TestInputBuffer.java test/org/apache/catalina/connector/TestInputBuffer.java index c3d8867..0555618 100644 --- test/org/apache/catalina/connector/TestInputBuffer.java +++ test/org/apache/catalina/connector/TestInputBuffer.java @@ -42,7 +42,8 @@ public class TestInputBuffer extends TomcatBaseTest { @Test public void testUtf8Body() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Echo", new Utf8Echo()); root.addServletMapping("/test", "Echo"); diff --git test/org/apache/catalina/connector/TestKeepAliveCount.java test/org/apache/catalina/connector/TestKeepAliveCount.java index af9b584..41004bf 100644 --- test/org/apache/catalina/connector/TestKeepAliveCount.java +++ test/org/apache/catalina/connector/TestKeepAliveCount.java @@ -56,7 +56,8 @@ public class TestKeepAliveCount extends TomcatBaseTest { if (init) return; Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); tomcat.getConnector().setProperty("maxKeepAliveRequests", "5"); diff --git test/org/apache/catalina/connector/TestMaxConnections.java test/org/apache/catalina/connector/TestMaxConnections.java index e1d52ec..ed284fa 100644 --- test/org/apache/catalina/connector/TestMaxConnections.java +++ test/org/apache/catalina/connector/TestMaxConnections.java @@ -70,7 +70,8 @@ public class TestMaxConnections extends TomcatBaseTest { private synchronized void init() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", SimpleHttpClient.TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Simple", new SimpleServlet()); root.addServletMapping("/test", "Simple"); tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"); diff --git test/org/apache/catalina/connector/TestOutputBuffer.java test/org/apache/catalina/connector/TestOutputBuffer.java index 73241d7..cd5207c 100644 --- test/org/apache/catalina/connector/TestOutputBuffer.java +++ test/org/apache/catalina/connector/TestOutputBuffer.java @@ -39,7 +39,8 @@ public class TestOutputBuffer extends TomcatBaseTest{ public void testWriteSpeed() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); for (int i = 1; i <= WritingServlet.EXPECTED_CONTENT_LENGTH; i*=10) { WritingServlet servlet = new WritingServlet(i); @@ -74,7 +75,8 @@ public class TestOutputBuffer extends TomcatBaseTest{ public void testBug52577() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Bug52577Servlet bug52577 = new Bug52577Servlet(); Tomcat.addServlet(root, "bug52577", bug52577); diff --git test/org/apache/catalina/connector/TestRequest.java test/org/apache/catalina/connector/TestRequest.java index b6ab6d6..68c5ee6 100644 --- test/org/apache/catalina/connector/TestRequest.java +++ test/org/apache/catalina/connector/TestRequest.java @@ -175,7 +175,8 @@ public class TestRequest extends TomcatBaseTest { if (init) return; Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet()); root.addServletMapping("/test", "Bug37794"); @@ -272,9 +273,8 @@ public class TestRequest extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Add the Servlet Tomcat.addServlet(ctx, "servlet", new EchoQueryStringServlet()); @@ -317,9 +317,8 @@ public class TestRequest extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); LoginConfig config = new LoginConfig(); config.setAuthMethod("BASIC"); @@ -371,8 +370,8 @@ public class TestRequest extends TomcatBaseTest { @Test public void testBug49424NoChunking() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet()); root.addServletMapping("/", "Bug37794"); tomcat.start(); @@ -385,8 +384,8 @@ public class TestRequest extends TomcatBaseTest { @Test public void testBug49424WithChunking() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet()); root.addServletMapping("/", "Bug37794"); tomcat.start(); @@ -477,8 +476,8 @@ public class TestRequest extends TomcatBaseTest { @Test public void testBug54984() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context root = tomcat.addContext("", null); root.setAllowCasualMultipartParsing(true); Tomcat.addServlet(root, "Bug54984", new Bug54984Servlet()); root.addServletMapping("/", "Bug54984"); @@ -555,7 +554,8 @@ public class TestRequest extends TomcatBaseTest { if (init) return; Tomcat tomcat = getTomcatInstance(); - Context root = tomcat.addContext("", TEMP_DIR); + // No file system docBase required + Context root = tomcat.addContext("", null); Tomcat.addServlet(root, "EchoParameters", new EchoParametersServlet()); root.addServletMapping("/echo", "EchoParameters"); tomcat.start(); @@ -818,9 +818,8 @@ public class TestRequest extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext(deployPath, - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext(deployPath, null); Tomcat.addServlet(ctx, "servlet", new Bug56501Servelet()); ctx.addServletMapping("/*", "servlet"); diff --git test/org/apache/catalina/connector/TestResponse.java test/org/apache/catalina/connector/TestResponse.java index 87e7f9a..d61b768 100644 --- test/org/apache/catalina/connector/TestResponse.java +++ test/org/apache/catalina/connector/TestResponse.java @@ -51,9 +51,8 @@ public class TestResponse extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new Bug49598Servlet()); ctx.addServletMapping("/", "servlet"); @@ -108,9 +107,8 @@ public class TestResponse extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new CharsetServlet()); ctx.addServletMapping("/", "servlet"); @@ -148,9 +146,8 @@ public class TestResponse extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new Bug52811Servlet()); ctx.addServletMapping("/", "servlet"); diff --git test/org/apache/catalina/core/TestApplicationContext.java test/org/apache/catalina/core/TestApplicationContext.java index 110d631..adcde1c 100644 --- test/org/apache/catalina/core/TestApplicationContext.java +++ test/org/apache/catalina/core/TestApplicationContext.java @@ -171,10 +171,12 @@ public class TestApplicationContext extends TomcatBaseTest { foo2.addLifecycleListener(new SetIdListener("foo2")); tomcat.getHost().addChild(foo2); - Context bar = tomcat.addContext("/bar", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context bar = tomcat.addContext("/bar", null); bar.addLifecycleListener(new SetIdListener("bar")); - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addLifecycleListener(new SetIdListener("ROOT")); ctx.setCrossContext(true); diff --git test/org/apache/catalina/core/TestApplicationFilterConfig.java test/org/apache/catalina/core/TestApplicationFilterConfig.java index 24f3409..4eb2a78 100644 --- test/org/apache/catalina/core/TestApplicationFilterConfig.java +++ test/org/apache/catalina/core/TestApplicationFilterConfig.java @@ -37,9 +37,8 @@ public class TestApplicationFilterConfig extends TomcatBaseTest { public void testBug54170() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "HelloWorld", new HelloWorldServlet()); ctx.addServletMapping("/", "HelloWorld"); diff --git test/org/apache/catalina/core/TestAsyncContextImpl.java test/org/apache/catalina/core/TestAsyncContextImpl.java index 98b99ab..25d5193 100644 --- test/org/apache/catalina/core/TestAsyncContextImpl.java +++ test/org/apache/catalina/core/TestAsyncContextImpl.java @@ -87,9 +87,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug49528Servlet servlet = new Bug49528Servlet(); @@ -125,9 +124,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug49567Servlet servlet = new Bug49567Servlet(); @@ -168,9 +166,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { tomcat.getConnector().setAttribute( "connectionTimeout", Integer.valueOf(3000)); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncStartNoCompleteServlet servlet = new AsyncStartNoCompleteServlet(); @@ -208,9 +205,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncStartWithCompleteServlet servlet = new AsyncStartWithCompleteServlet(); @@ -466,10 +462,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); TimeoutServlet timeout = new TimeoutServlet(completeOnTimeout, dispatchUrl); @@ -624,10 +618,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); DispatchingServlet dispatch = new DispatchingServlet(false, false); Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch); @@ -745,10 +737,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); TrackingServlet tracking = new TrackingServlet(); Wrapper wrapper = Tomcat.addServlet(ctx, "tracking", tracking); @@ -969,10 +959,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); DispatchingServlet dispatch = new DispatchingServlet(true, completeOnError); @@ -1050,10 +1038,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncStartRunnable servlet = new AsyncStartRunnable(); Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servlet); @@ -1119,9 +1105,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug50753Servlet servlet = new Bug50753Servlet(); @@ -1184,10 +1169,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ErrorServlet error = new ErrorServlet(); Tomcat.addServlet(ctx, "error", error); @@ -1220,10 +1203,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncStatusServlet asyncStatusServlet = new AsyncStatusServlet(HttpServletResponse.SC_BAD_REQUEST); @@ -1300,10 +1281,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncErrorServlet asyncErrorServlet = new AsyncErrorServlet(HttpServletResponse.SC_BAD_REQUEST, threaded); @@ -1419,10 +1398,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Wrapper a = Tomcat.addServlet(ctx, "ServletA", new Bug53337ServletA()); a.setAsyncSupported(true); Wrapper b = Tomcat.addServlet(ctx, "ServletB", new Bug53337ServletB()); @@ -1500,10 +1477,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug53843ServletA servletA = new Bug53843ServletA(); Wrapper a = Tomcat.addServlet(ctx, "ServletA", servletA); a.setAsyncSupported(true); @@ -1614,10 +1589,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); TimeoutServlet timeout = new TimeoutServlet(null, null); Wrapper w1 = Tomcat.addServlet(ctx, "time", timeout); @@ -1745,10 +1718,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug54178ServletA bug54178ServletA = new Bug54178ServletA(); Wrapper wrapper = @@ -1850,10 +1821,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); NonAsyncServlet nonAsyncServlet = new NonAsyncServlet(); Wrapper wrapper = Tomcat.addServlet(ctx, "nonAsyncServlet", @@ -2002,10 +1971,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext(contextPath, docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext(contextPath, null); DispatchingGenericServlet dispatch = new DispatchingGenericServlet(); Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch); @@ -2054,9 +2021,8 @@ public class TestAsyncContextImpl extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); AsyncISEServlet servlet = new AsyncISEServlet(); @@ -2125,8 +2091,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // No file system docBase required - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + Context ctx = tomcat.addContext("", null); Servlet stage1 = new DispatchingServletTracking("/stage2", true); Wrapper wrapper1 = Tomcat.addServlet(ctx, "stage1", stage1); diff --git test/org/apache/catalina/core/TestNamingContextListener.java test/org/apache/catalina/core/TestNamingContextListener.java index c7e7457..9f03a20 100644 --- test/org/apache/catalina/core/TestNamingContextListener.java +++ test/org/apache/catalina/core/TestNamingContextListener.java @@ -48,9 +48,8 @@ public class TestNamingContextListener extends TomcatBaseTest { public void testBug49132() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // Enable JNDI - it is disabled by default tomcat.enableNaming(); @@ -96,9 +95,8 @@ public class TestNamingContextListener extends TomcatBaseTest { public void testBug54096() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // Enable JNDI - it is disabled by default tomcat.enableNaming(); diff --git test/org/apache/catalina/core/TestStandardContext.java test/org/apache/catalina/core/TestStandardContext.java index 4046803..58cb437 100644 --- test/org/apache/catalina/core/TestStandardContext.java +++ test/org/apache/catalina/core/TestStandardContext.java @@ -418,9 +418,8 @@ public class TestStandardContext extends TomcatBaseTest { // Set up a container Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Setup realm MapRealm realm = new MapRealm(); @@ -501,9 +500,8 @@ public class TestStandardContext extends TomcatBaseTest { // Set up a container Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Add ServletContainerInitializer Bug51376SCI sci = new Bug51376SCI(loadOnStartUp); diff --git test/org/apache/catalina/core/TestStandardContextValve.java test/org/apache/catalina/core/TestStandardContextValve.java index b0657fd..bef76b9 100644 --- test/org/apache/catalina/core/TestStandardContextValve.java +++ test/org/apache/catalina/core/TestStandardContextValve.java @@ -43,9 +43,8 @@ public class TestStandardContextValve extends TomcatBaseTest { // Set up a container Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Traces order of events across multiple components StringBuilder trace = new StringBuilder(); @@ -90,9 +89,8 @@ public class TestStandardContextValve extends TomcatBaseTest { // Set up a container Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Traces order of events across multiple components StringBuilder trace = new StringBuilder(); diff --git test/org/apache/catalina/core/TestStandardHostValve.java test/org/apache/catalina/core/TestStandardHostValve.java index f704408..c12bbfd 100644 --- test/org/apache/catalina/core/TestStandardHostValve.java +++ test/org/apache/catalina/core/TestStandardHostValve.java @@ -45,9 +45,8 @@ public class TestStandardHostValve extends TomcatBaseTest { // Set up a container Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Add the error page Tomcat.addServlet(ctx, "error", new ErrorServlet()); diff --git test/org/apache/catalina/core/TestStandardWrapper.java test/org/apache/catalina/core/TestStandardWrapper.java index 542b255..a4fdec9 100644 --- test/org/apache/catalina/core/TestStandardWrapper.java +++ test/org/apache/catalina/core/TestStandardWrapper.java @@ -199,9 +199,8 @@ public class TestStandardWrapper extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Servlet s = new DenyAllServlet(); ServletContainerInitializer sci = new SCI(s, useCreateServlet); @@ -228,9 +227,8 @@ public class TestStandardWrapper extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servletClassName); wrapper.setAsyncSupported(true); @@ -366,9 +364,8 @@ public class TestStandardWrapper extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); Tomcat.addServlet(ctx, "Bug51445", new Bug51445Servlet()); ctx.addServletMapping("/", "Bug51445"); @@ -410,9 +407,8 @@ public class TestStandardWrapper extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); StandardWrapper wrapper = new StandardWrapper(); wrapper.setServletName("Bug51445"); diff --git test/org/apache/catalina/filters/TestAddCharSetFilter.java test/org/apache/catalina/filters/TestAddCharSetFilter.java index 1e8d7cc..7eb088e 100644 --- test/org/apache/catalina/filters/TestAddCharSetFilter.java +++ test/org/apache/catalina/filters/TestAddCharSetFilter.java @@ -91,9 +91,8 @@ public class TestAddCharSetFilter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Add the Servlet CharsetServlet servlet = new CharsetServlet(mode); diff --git test/org/apache/catalina/loader/TestWebappClassLoaderExecutorMemoryLeak.java test/org/apache/catalina/loader/TestWebappClassLoaderExecutorMemoryLeak.java index ba10053..60c16bb 100644 --- test/org/apache/catalina/loader/TestWebappClassLoaderExecutorMemoryLeak.java +++ test/org/apache/catalina/loader/TestWebappClassLoaderExecutorMemoryLeak.java @@ -41,9 +41,8 @@ public class TestWebappClassLoaderExecutorMemoryLeak extends TomcatBaseTest { public void testTimerThreadLeak() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); if (ctx instanceof StandardContext) { ((StandardContext) ctx).setClearReferencesStopThreads(true); diff --git test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java index 2b4993c..1adf6f2 100644 --- test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java +++ test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java @@ -40,9 +40,8 @@ public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest { public void testTimerThreadLeak() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); if (ctx instanceof StandardContext) { ((StandardContext) ctx).setClearReferencesStopTimerThreads(true); diff --git test/org/apache/catalina/loader/TestWebappClassLoaderThreadLocalMemoryLeak.java test/org/apache/catalina/loader/TestWebappClassLoaderThreadLocalMemoryLeak.java index 1c4a137..c5c7651 100644 --- test/org/apache/catalina/loader/TestWebappClassLoaderThreadLocalMemoryLeak.java +++ test/org/apache/catalina/loader/TestWebappClassLoaderThreadLocalMemoryLeak.java @@ -64,9 +64,8 @@ public class TestWebappClassLoaderThreadLocalMemoryLeak extends TomcatBaseTest { tomcat.getServer().addLifecycleListener( new JreMemoryLeakPreventionListener()); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "leakServlet1", "org.apache.tomcat.unittest.TesterLeakingServlet1"); @@ -121,9 +120,8 @@ public class TestWebappClassLoaderThreadLocalMemoryLeak extends TomcatBaseTest { tomcat.getServer().addLifecycleListener( new JreMemoryLeakPreventionListener()); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "leakServlet2", "org.apache.tomcat.unittest.TesterLeakingServlet2"); diff --git test/org/apache/catalina/session/TestPersistentManager.java test/org/apache/catalina/session/TestPersistentManager.java index 8e91008..5fe9030 100644 --- test/org/apache/catalina/session/TestPersistentManager.java +++ test/org/apache/catalina/session/TestPersistentManager.java @@ -168,9 +168,8 @@ public class TestPersistentManager extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet()); ctx.addServletMapping("/dummy", "DummyServlet"); diff --git test/org/apache/catalina/session/TestStandardSession.java test/org/apache/catalina/session/TestStandardSession.java index 1d9e448..0139c86 100644 --- test/org/apache/catalina/session/TestStandardSession.java +++ test/org/apache/catalina/session/TestStandardSession.java @@ -53,8 +53,8 @@ public class TestStandardSession extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug56578", new Bug56578Servlet()); ctx.addServletMapping("/bug56578", "bug56578"); diff --git test/org/apache/catalina/startup/TestListener.java test/org/apache/catalina/startup/TestListener.java index a716e77..13a73a2 100644 --- test/org/apache/catalina/startup/TestListener.java +++ test/org/apache/catalina/startup/TestListener.java @@ -42,8 +42,8 @@ public class TestListener extends TomcatBaseTest { public void testServletContainerInitializer() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context context = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context context = tomcat.addContext("", null); context.addServletContainerInitializer(new SCI(), null); tomcat.start(); @@ -59,8 +59,8 @@ public class TestListener extends TomcatBaseTest { public void testServletContextListener() throws Exception { Tomcat tomcat = getTomcatInstance(); - Context context = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context context = tomcat.addContext("", null); // SCL2 pretends to be in web.xml, and tries to install a // ServletContainerInitializer. diff --git test/org/apache/catalina/startup/TestTomcat.java test/org/apache/catalina/startup/TestTomcat.java index 1715d69..7efde56 100644 --- test/org/apache/catalina/startup/TestTomcat.java +++ test/org/apache/catalina/startup/TestTomcat.java @@ -245,9 +245,8 @@ public class TestTomcat extends TomcatBaseTest { public void testProgrammatic() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // You can customize the context by calling // its API @@ -294,9 +293,8 @@ public class TestTomcat extends TomcatBaseTest { public void testSession() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // You can customize the context by calling // its API @@ -327,9 +325,8 @@ public class TestTomcat extends TomcatBaseTest { public void testEnableNaming() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // You can customise the context by calling its API @@ -358,9 +355,8 @@ public class TestTomcat extends TomcatBaseTest { public void testEnableNamingGlobal() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); // You can customise the context by calling its API @@ -438,9 +434,8 @@ public class TestTomcat extends TomcatBaseTest { public void testBug53301() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - org.apache.catalina.Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + org.apache.catalina.Context ctx = tomcat.addContext("", null); InitCount initCount = new InitCount(); Tomcat.addServlet(ctx, "initCount", initCount); diff --git test/org/apache/catalina/startup/TestTomcatClassLoader.java test/org/apache/catalina/startup/TestTomcatClassLoader.java index 4e63ba2..6d713e4 100644 --- test/org/apache/catalina/startup/TestTomcatClassLoader.java +++ test/org/apache/catalina/startup/TestTomcatClassLoader.java @@ -40,9 +40,8 @@ public class TestTomcatClassLoader extends TomcatBaseTest { public void testDefaultClassLoader() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(null)); ctx.addServletMapping("/", "ClassLoaderReport"); @@ -64,9 +63,8 @@ public class TestTomcatClassLoader extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); tomcat.getServer().setParentClassLoader(cl); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(cl)); ctx.addServletMapping("/", "ClassLoaderReport"); diff --git test/org/apache/catalina/valves/TestErrorReportValve.java test/org/apache/catalina/valves/TestErrorReportValve.java index 025eccb..2933123 100644 --- test/org/apache/catalina/valves/TestErrorReportValve.java +++ test/org/apache/catalina/valves/TestErrorReportValve.java @@ -41,9 +41,8 @@ public class TestErrorReportValve extends TomcatBaseTest { public void testBug53071() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "errorServlet", new ErrorServlet()); ctx.addServletMapping("/", "errorServlet"); @@ -75,9 +74,8 @@ public class TestErrorReportValve extends TomcatBaseTest { public void testBug54220DoNotSetNotFound() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(false)); ctx.addServletMapping("/", "bug54220"); @@ -96,9 +94,8 @@ public class TestErrorReportValve extends TomcatBaseTest { public void testBug54220SetNotFound() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(true)); ctx.addServletMapping("/", "bug54220"); @@ -141,9 +138,8 @@ public class TestErrorReportValve extends TomcatBaseTest { public void testBug54536() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug54536", new Bug54536Servlet()); ctx.addServletMapping("/", "bug54536"); @@ -178,10 +174,8 @@ public class TestErrorReportValve extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - File docBase = new File(System.getProperty("java.io.tmpdir")); - - Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Bug56042Servlet bug56042Servlet = new Bug56042Servlet(); Wrapper wrapper = diff --git test/org/apache/catalina/websocket/TestWebSocket.java test/org/apache/catalina/websocket/TestWebSocket.java index 263a4e8..117e92a 100644 --- test/org/apache/catalina/websocket/TestWebSocket.java +++ test/org/apache/catalina/websocket/TestWebSocket.java @@ -68,9 +68,8 @@ public class TestWebSocket extends TomcatBaseTest { @Test public void testSimple() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(new ApplicationListener( TesterEchoServer.Config.class.getName(), false)); @@ -114,9 +113,8 @@ public class TestWebSocket extends TomcatBaseTest { @Test public void testDetectWrongVersion() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(new ApplicationListener( TesterEchoServer.Config.class.getName(), false)); @@ -157,9 +155,8 @@ public class TestWebSocket extends TomcatBaseTest { @Test public void testNoConnection() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(new ApplicationListener( TesterEchoServer.Config.class.getName(), false)); @@ -191,9 +188,8 @@ public class TestWebSocket extends TomcatBaseTest { @Test public void testNoUpgrade() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(new ApplicationListener( TesterEchoServer.Config.class.getName(), false)); @@ -226,9 +222,8 @@ public class TestWebSocket extends TomcatBaseTest { @Test public void testKey() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(new ApplicationListener( TesterEchoServer.Config.class.getName(), false)); @@ -283,9 +278,8 @@ public class TestWebSocket extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "Bug53339", new Bug53339Servlet()); ctx.addServletMapping("/*", "Bug53339"); diff --git test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java index 653be82..1531694 100644 --- test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java +++ test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java @@ -75,8 +75,8 @@ public class TestAbstractAjpProcessor extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize)); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "snoop", new SnoopServlet()); ctx.addServletMapping("/", "snoop"); @@ -452,8 +452,8 @@ public class TestAbstractAjpProcessor extends TomcatBaseTest { tomcat.getConnector().setProperty("requiredSecret", "RIGHTSECRET"); tomcat.start(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet()); ctx.addServletMapping("/", "helloWorld"); @@ -512,8 +512,8 @@ public class TestAbstractAjpProcessor extends TomcatBaseTest { tomcat.getConnector().setProperty("connectionTimeout", "-1"); tomcat.start(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet()); ctx.addServletMapping("/", "helloWorld"); @@ -622,8 +622,8 @@ public class TestAbstractAjpProcessor extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "bug55453", new Tester304WithBodyServlet()); ctx.addServletMapping("/", "bug55453"); @@ -661,7 +661,7 @@ public class TestAbstractAjpProcessor extends TomcatBaseTest { tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize)); // No file system docBase required - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + Context ctx = tomcat.addContext("", null); FixedResponseSizeServlet servlet = new FixedResponseSizeServlet(15000, 16000); Tomcat.addServlet(ctx, "FixedResponseSizeServlet", servlet); diff --git test/org/apache/coyote/http11/TestAbstractHttp11Processor.java test/org/apache/coyote/http11/TestAbstractHttp11Processor.java index c2c41a6..26c7a6d 100644 --- test/org/apache/coyote/http11/TestAbstractHttp11Processor.java +++ test/org/apache/coyote/http11/TestAbstractHttp11Processor.java @@ -61,8 +61,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { public void testResponseWithErrorChunked() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); // Add protected servlet Tomcat.addServlet(ctxt, "ChunkedResponseWithErrorServlet", @@ -350,9 +350,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { public void testPipelining() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); // Add protected servlet Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet()); @@ -411,9 +410,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { public void testChunking11NoContentLength() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); Tomcat.addServlet(ctxt, "NoContentLengthFlushingServlet", new NoContentLengthFlushingServlet()); @@ -440,9 +438,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); Tomcat.addServlet(ctxt, "NoContentLengthConnectionCloseFlushingServlet", new NoContentLengthConnectionCloseFlushingServlet()); @@ -482,9 +479,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { private void doTestBug53677(boolean flush) throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); Tomcat.addServlet(ctxt, "LargeHeaderServlet", new LargeHeaderServlet(flush)); @@ -520,9 +516,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { tomcat.getConnector().setProperty("processorCache", "1"); tomcat.getConnector().setProperty("maxThreads", "1"); - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctxt = tomcat.addContext("", null); Tomcat.addServlet(ctxt, "async", new Bug55772Servlet()); ctxt.addServletMapping("/*", "async"); @@ -613,8 +608,8 @@ public class TestAbstractHttp11Processor extends TomcatBaseTest { private void doTestNon2xxResponseAndExpectation(boolean useExpectation) throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "echo", new EchoBodyServlet()); ctx.addServletMapping("/echo", "echo"); diff --git test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java index 458184e..53ff2b0 100644 --- test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java +++ test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java @@ -101,9 +101,8 @@ public class TestChunkedInputFilter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); // Configure allowed trailer headers tomcat.getConnector().setProperty("allowedTrailerHeaders", "X-Trailer1,X-Trailer2"); @@ -168,9 +167,8 @@ public class TestChunkedInputFilter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(false)); ctx.addServletMapping("/", "servlet"); @@ -232,9 +230,8 @@ public class TestChunkedInputFilter extends TomcatBaseTest { tomcat.getConnector().setProperty( "maxExtensionSize", Integer.toString(EXT_SIZE_LIMIT)); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(ok)); ctx.addServletMapping("/", "servlet"); @@ -281,9 +278,8 @@ public class TestChunkedInputFilter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(true)); ctx.addServletMapping("/", "servlet"); @@ -381,9 +377,8 @@ public class TestChunkedInputFilter extends TomcatBaseTest { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); BodyReadServlet servlet = new BodyReadServlet(expectPass, readLimit); Tomcat.addServlet(ctx, "servlet", servlet); diff --git test/org/apache/naming/resources/TestNamingContext.java test/org/apache/naming/resources/TestNamingContext.java index 53555cc..bcf506c 100644 --- test/org/apache/naming/resources/TestNamingContext.java +++ test/org/apache/naming/resources/TestNamingContext.java @@ -62,10 +62,9 @@ public class TestNamingContext extends TomcatBaseTest { public void doTestLookup(boolean useSingletonResource) throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); // Create the resource ContextResource cr = new ContextResource(); @@ -255,10 +254,9 @@ public class TestNamingContext extends TomcatBaseTest { public void testListBindings() throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); // Create the resource ContextResource cr = new ContextResource(); @@ -307,10 +305,9 @@ public class TestNamingContext extends TomcatBaseTest { public void testBeanFactory() throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); // Create the resource ContextResource cr = new ContextResource(); @@ -367,10 +364,9 @@ public class TestNamingContext extends TomcatBaseTest { throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); ctx.setJndiExceptionOnFailedWrite(exceptionOnFailedWrite); @@ -427,9 +423,8 @@ public class TestNamingContext extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); // Create the resource ContextEnvironment env = new ContextEnvironment(); diff --git test/org/apache/naming/resources/TestProxyDirContext.java test/org/apache/naming/resources/TestProxyDirContext.java index be92c5a..90fdeb5 100644 --- test/org/apache/naming/resources/TestProxyDirContext.java +++ test/org/apache/naming/resources/TestProxyDirContext.java @@ -39,9 +39,8 @@ public class TestProxyDirContext extends TomcatBaseTest { public void testLookupException() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - StandardContext ctx = (StandardContext) - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + StandardContext ctx = (StandardContext) tomcat.addContext("", null); ctx.setCacheTTL(500); tomcat.start(); diff --git test/org/apache/tomcat/util/http/CookiesBaseTest.java test/org/apache/tomcat/util/http/CookiesBaseTest.java index f7f9d0f..69d5384 100644 --- test/org/apache/tomcat/util/http/CookiesBaseTest.java +++ test/org/apache/tomcat/util/http/CookiesBaseTest.java @@ -67,9 +67,8 @@ public abstract class CookiesBaseTest extends TomcatBaseTest { public static void addServlets(Tomcat tomcat) { - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "invalid", new CookieServlet("na;me", "value")); ctx.addServletMapping("/invalid", "invalid"); diff --git test/org/apache/tomcat/util/http/TestBug49158.java test/org/apache/tomcat/util/http/TestBug49158.java index e5781cc..481b203 100644 --- test/org/apache/tomcat/util/http/TestBug49158.java +++ test/org/apache/tomcat/util/http/TestBug49158.java @@ -60,9 +60,8 @@ public class TestBug49158 extends CookiesBaseTest { } public static void addServlets(Tomcat tomcat) { - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, path, new TestBug49158Servlet()); ctx.addServletMapping("/"+path, path); diff --git test/org/apache/tomcat/util/http/mapper/TestMapperWebapps.java test/org/apache/tomcat/util/http/mapper/TestMapperWebapps.java index 86b40ad..2061d1b 100644 --- test/org/apache/tomcat/util/http/mapper/TestMapperWebapps.java +++ test/org/apache/tomcat/util/http/mapper/TestMapperWebapps.java @@ -45,9 +45,8 @@ public class TestMapperWebapps extends TomcatBaseTest{ Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "Bug53356", new Bug53356Servlet()); ctx.addServletMapping("", "Bug53356"); diff --git test/org/apache/tomcat/util/net/TesterSupport.java test/org/apache/tomcat/util/net/TesterSupport.java index 69b7874..ed8f216 100644 --- test/org/apache/tomcat/util/net/TesterSupport.java +++ test/org/apache/tomcat/util/net/TesterSupport.java @@ -194,9 +194,8 @@ public final class TesterSupport { TesterSupport.initSsl(tomcat); // Need a web application with a protected and unprotected URL - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); Tomcat.addServlet(ctx, "simple", new SimpleServlet()); ctx.addServletMapping("/unprotected", "simple"); diff --git test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java index c188775..bf43912 100644 --- test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java +++ test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java @@ -42,9 +42,8 @@ public class TestWebSocketFrameClient extends TomcatBaseTest { public void testConnectToServerEndpoint() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -85,13 +84,11 @@ public class TestWebSocketFrameClient extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); // No file system docBase required - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); - Context ctx2 = - tomcat.addContext("/foo", System.getProperty("java.io.tmpdir")); + Context ctx2 = tomcat.addContext("/foo", null); ctx2.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx2, "default", new DefaultServlet()); ctx2.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java index 25be50f..6724063 100644 --- test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java +++ test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java @@ -49,9 +49,8 @@ public class TestWebSocketFrameClientSSL extends TomcatBaseTest { public void testConnectToServerEndpointSSL() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -107,9 +106,8 @@ public class TestWebSocketFrameClientSSL extends TomcatBaseTest { getTomcatInstance().getConnector().getProtocol().equals("HTTP/1.1")); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/TestWsPingPongMessages.java test/org/apache/tomcat/websocket/TestWsPingPongMessages.java index 7d537df..3f45e94 100644 --- test/org/apache/tomcat/websocket/TestWsPingPongMessages.java +++ test/org/apache/tomcat/websocket/TestWsPingPongMessages.java @@ -46,9 +46,8 @@ public class TestWsPingPongMessages extends TomcatBaseTest { @Test public void testPingPongMessages() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); diff --git test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java index ca9449e..fda90c1 100644 --- test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java +++ test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java @@ -82,9 +82,8 @@ public class TestWsRemoteEndpoint extends TomcatBaseTest { private void doTestWriter(Class clazz, boolean useWriter) throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/TestWsSubprotocols.java test/org/apache/tomcat/websocket/TestWsSubprotocols.java index 639e47a..4f496ed 100644 --- test/org/apache/tomcat/websocket/TestWsSubprotocols.java +++ test/org/apache/tomcat/websocket/TestWsSubprotocols.java @@ -49,9 +49,8 @@ public class TestWsSubprotocols extends TomcatBaseTest { @Test public void testWsSubprotocols() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", - System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); diff --git test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java index 09d9561..a94cbb4 100644 --- test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java +++ test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java @@ -82,9 +82,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { @Test public void testConnectToServerEndpoint() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -121,9 +120,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { @Test(expected=javax.websocket.DeploymentException.class) public void testConnectToServerEndpointInvalidScheme() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); tomcat.start(); @@ -140,9 +138,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { @Test(expected=javax.websocket.DeploymentException.class) public void testConnectToServerEndpointNoHost() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); tomcat.start(); @@ -207,9 +204,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { boolean isTextMessage, boolean pass) throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -316,9 +312,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(BlockingConfig.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -404,9 +399,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ConstantTxConfig.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -588,9 +582,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { @Test public void testGetOpenSessions() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -637,9 +630,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { public void testSessionExpiryContainer() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -695,9 +687,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { public void testSessionExpirySession() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -781,9 +772,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { public void testConnectToServerEndpointSSL() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -868,9 +858,8 @@ public class TestWsWebSocketContainer extends TomcatBaseTest { throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(TesterEchoServer.Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java index 40f06af..6553a81 100644 --- test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java +++ test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java @@ -68,8 +68,8 @@ public class TestEncodingDecoding extends TomcatBaseTest { @Test public void testProgrammaticEndPoints() throws Exception{ Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener( ProgramaticServerEndpointConfig.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); @@ -118,9 +118,8 @@ public class TestEncodingDecoding extends TomcatBaseTest { ServerConfigListener.setPojoClazz(Server.class); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ServerConfigListener.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -178,9 +177,8 @@ public class TestEncodingDecoding extends TomcatBaseTest { ServerConfigListener.setPojoClazz(GenericsServer.class); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ServerConfigListener.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -608,8 +606,8 @@ public class TestEncodingDecoding extends TomcatBaseTest { @Test public void testUnsupportedObject() throws Exception{ Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ProgramaticServerEndpointConfig.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java index c76cb83..f245c04 100644 --- test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java +++ test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java @@ -52,9 +52,8 @@ public class TestPojoEndpointBase extends TomcatBaseTest { ServerConfigListener.setPojoClazz(Bug54716.class); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ServerConfigListener.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); @@ -84,9 +83,8 @@ public class TestPojoEndpointBase extends TomcatBaseTest { ServerConfigListener.setPojoClazz(OnOpenServerEndpoint.class); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ServerConfigListener.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java index 51ec902..8081e39 100644 --- test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java +++ test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java @@ -55,9 +55,8 @@ public class TestPojoMethodMapping extends TomcatBaseTest { ServerConfigListener.setPojoClazz(Server.class); Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(ServerConfigListener.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default"); diff --git test/org/apache/tomcat/websocket/server/TestWsServerContainer.java test/org/apache/tomcat/websocket/server/TestWsServerContainer.java index fdbff48..b36a98e 100644 --- test/org/apache/tomcat/websocket/server/TestWsServerContainer.java +++ test/org/apache/tomcat/websocket/server/TestWsServerContainer.java @@ -38,9 +38,8 @@ public class TestWsServerContainer extends TomcatBaseTest { @Test public void testBug54807() throws Exception { Tomcat tomcat = getTomcatInstance(); - // Must have a real docBase - just use temp - Context ctx = - tomcat.addContext("", System.getProperty("java.io.tmpdir")); + // No file system docBase required + Context ctx = tomcat.addContext("", null); ctx.addApplicationListener(Bug54807Config.class.getName()); Tomcat.addServlet(ctx, "default", new DefaultServlet()); ctx.addServletMapping("/", "default");