MCPcopy Create free account
hub / github.com/apache/tomcat / createContext

Method createContext

java/org/apache/catalina/startup/Tomcat.java:962–981  ·  view source on GitHub ↗

Create the configured Context for the given host . The default constructor of the class that was configured with StandardHost#setContextClass(String) will be used @param host host for which the Context should be created, or null if default host shoul

(Host host, String url)

Source from the content-addressed store, hash-verified

960 * @return newly created {@link Context}
961 */
962 private Context createContext(Host host, String url) {
963 String defaultContextClass = StandardContext.class.getName();
964 String contextClass = StandardContext.class.getName();
965 if (host == null) {
966 host = this.getHost();
967 }
968 if (host instanceof StandardHost) {
969 contextClass = ((StandardHost) host).getContextClass();
970 }
971 try {
972 if (defaultContextClass.equals(contextClass)) {
973 return new StandardContext();
974 } else {
975 return (Context) Class.forName(contextClass).getConstructor().newInstance();
976 }
977
978 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
979 throw new IllegalArgumentException(sm.getString("tomcat.noContextClass", contextClass, host, url), e);
980 }
981 }
982
983 /**
984 * Enables JNDI naming which is disabled by default. Server must implement {@link Lifecycle} in order for the

Callers 3

addContextMethod · 0.95
addWebappMethod · 0.95
doAuthenticateMethod · 0.45

Calls 8

getHostMethod · 0.95
forNameMethod · 0.80
getNameMethod · 0.65
equalsMethod · 0.65
newInstanceMethod · 0.65
getStringMethod · 0.65
getContextClassMethod · 0.45
getConstructorMethod · 0.45

Tested by

no test coverage detected