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)
| 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 |
no test coverage detected