junit-servers-tomcat/src/main/java/com/github/mjeanroy/junit/servers/tomcat/EmbeddedTomcat.java
@Deprecated
	protected Context createContext() throws Exception {
		Context context = null;

		final String webapp = configuration.getWebapp();
		final String path = configuration.getPath();
		final String classpath = configuration.getClasspath();
		final boolean forceMetaInf = configuration.isForceMetaInf();
		final ClassLoader parentClassLoader = configuration.getParentClasspath();
		final String descriptor = configuration.getOverrideDescriptor();

		File webappDirectory = new File(webapp);
		if (webappDirectory.exists()) {
			String webappAbsolutePath = webappDirectory.getAbsolutePath();
			tomcat.getHost().setAppBase(webappAbsolutePath);
			context = tomcat.addWebapp(path, webappAbsolutePath);

			// Add additional classpath entry
			if (isNotBlank(classpath)) {
				File file = new File(classpath);
				if (file.exists()) {

					// Check that additional classpath entry contains META-INF directory
					File metaInf = new File(file, "META-INF");
					if (!metaInf.exists() && forceMetaInf) {
						metaInf.mkdir();
					}

					// == Tomcat 8
					String absolutePath = file.getAbsolutePath();
					StandardRoot root = new StandardRoot(context);
					root.createWebResourceSet(
						WebResourceRoot.ResourceSetType.PRE,
						"/WEB-INF/classes",
						absolutePath,
						null,
						path
					);

					context.setResources(root);

					// == Tomcat 8

					// == Tomcat 7
					// String s = file.toURI().toString();
					// loader.addRepository(s);
					// == Tomcat 7

					// Used to scan additional classpath directory
					// https://issues.apache.org/bugzilla/show_bug.cgi?id=52853
					((StandardJarScanner) context.getJarScanner()).setScanAllDirectories(true);
				}
			}

			// Custom parent classloader.
			final ClassLoader threadCl = Thread.currentThread().getContextClassLoader();
			final ClassLoader tomcatParentClassLoader;

			if (parentClassLoader != null) {
				tomcatParentClassLoader = new CompositeClassLoader(parentClassLoader, threadCl);
			}
			else {
				tomcatParentClassLoader = threadCl;
			}

			// Set the parent class loader that will be given
			// to the created loader.
			//
			// Setting the parent class loader here is a shortcut for (code in previous versions):
			//
			//   Loader loader = context.getLoader();
			//   if (loader == null) {
			//     loader = new WebappLoader(parentClassLoader);
			//   }
			//
			context.setParentClassLoader(tomcatParentClassLoader);

			// Override web.xml path
			if (descriptor != null) {
				context.setAltDDName(descriptor);
			}
		}

		return context;
	}
@Deprecated
	protected Context createContext() throws Exception {
		Context context = null;

		final String webapp = configuration.getWebapp();
		final String path = configuration.getPath();
		final String classpath = configuration.getClasspath();
		final boolean forceMetaInf = configuration.isForceMetaInf();
		final ClassLoader parentClassLoader = configuration.getParentClasspath();
		final String descriptor = configuration.getOverrideDescriptor();

		File webappDirectory = new File(webapp);
		if (webappDirectory.exists()) {
			String webappAbsolutePath = webappDirectory.getAbsolutePath();
			tomcat.getHost().setAppBase(webappAbsolutePath);
			context = tomcat.addWebapp(path, webappAbsolutePath);

			// Add additional classpath entry
			if (isNotBlank(classpath)) {
				File file = new File(classpath);
				if (file.exists()) {

					// Check that additional classpath entry contains META-INF directory
					File metaInf = new File(file, "META-INF");
					if (!metaInf.exists() && forceMetaInf) {
						metaInf.mkdir();
					}

					// == Tomcat 8
					String absolutePath = file.getAbsolutePath();
					StandardRoot root = new StandardRoot(context);
					root.createWebResourceSet(
						WebResourceRoot.ResourceSetType.PRE,
						"/WEB-INF/classes",
						absolutePath,
						null,
						path
					);

					context.setResources(root);

					// == Tomcat 8

					// == Tomcat 7
					// String s = file.toURI().toString();
					// loader.addRepository(s);
					// == Tomcat 7

					// Used to scan additional classpath directory
					// https://issues.apache.org/bugzilla/show_bug.cgi?id=52853
					((StandardJarScanner) context.getJarScanner()).setScanAllDirectories(true);
				}
			}

			// Custom parent classloader.
			final ClassLoader threadCl = Thread.currentThread().getContextClassLoader();
			final ClassLoader tomcatParentClassLoader;

			if (parentClassLoader != null) {
				tomcatParentClassLoader = new CompositeClassLoader(parentClassLoader, threadCl);
			}
			else {
				tomcatParentClassLoader = threadCl;
			}

			// Set the parent class loader that will be given
			// to the created loader.
			//
			// Setting the parent class loader here is a shortcut for (code in previous versions):
			//
			//   Loader loader = context.getLoader();
			//   if (loader == null) {
			//     loader = new WebappLoader(parentClassLoader);
			//   }
			//
			context.setParentClassLoader(tomcatParentClassLoader);

			// Override web.xml path
			if (descriptor != null) {
				context.setAltDDName(descriptor);
			}
		}

		return context;
	}
Create tomcat context.
May be override by subclasses.

@return Tomcat context.
@throws Exception Exception May be thrown by web app context initialization (will be wrapped later).
@deprecated Protected visibility may be removed in a next release, please submit an issue <a href="https://github.com/mjeanroy/junit-servers/issues">here</a> to discuss it.