Source:
<code>private Context makeContext(Tomcat tomcat, Path noSuchBaseDir) throws IOException { Path contextPath = noSuchBaseDir.resolve("context"); Files.createDirectories(contextPath); Context context = tomcat.addContext(contextPathURIBase, contextPath.toAbsolutePath().toString()); context.setWebappVersion("3.1"); context.setName("Oryx"); ContextConfig contextConfig = new ContextConfig(); <START> String webxml = "oryx-ml-oryx-serving/src/main/resources/web.xml"; <END> if(new File(webxml).exists()) { contextConfig.setDefaultWebXml(webxml); } else { log.info("Could not read %s",webxml); } context.addLifecycleListener(contextConfig); boolean needHTTPS = keystoreFile != null; boolean needAuthentication = userName != null; if (needHTTPS || needAuthentication) { SecurityCollection securityCollection = new SecurityCollection(); securityCollection.addPattern("/*"); SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.addCollection(securityCollection); if (needHTTPS) { securityConstraint.setUserConstraint("CONFIDENTIAL"); } if (needAuthentication) { LoginConfig loginConfig = new LoginConfig(); loginConfig.setAuthMethod("DIGEST"); loginConfig.setRealmName(InMemoryRealm.NAME); context.setLoginConfig(loginConfig); securityConstraint.addAuthRole(InMemoryRealm.AUTH_ROLE); context.addSecurityRole(InMemoryRealm.AUTH_ROLE); DigestAuthenticator authenticator = new DigestAuthenticator(); authenticator.setNonceValidity(10 * 1000L); authenticator.setNonceCacheSize(20000); context.getPipeline().addValve(authenticator); } context.addConstraint(securityConstraint); } context.setCookies(false); return context; }</code><technical_language>This replaced a call :- String webxml = context.getResources().getResource("web.xml").getCanonicalPath();</technical_language>

Target:
private Context makeContext(Tomcat tomcat, Path noSuchBaseDir) throws IOException { Path contextPath = noSuchBaseDir.resolve("context"); Files.createDirectories(contextPath); Context context = tomcat.addContext(contextPathURIBase, contextPath.toAbsolutePath().toString()); context.setWebappVersion("3.1"); context.setName("Oryx"); ContextConfig contextConfig = new ContextConfig(); context.addLifecycleListener(contextConfig); boolean needHTTPS = keystoreFile != null; boolean needAuthentication = userName != null; if (needHTTPS || needAuthentication) { SecurityCollection securityCollection = new SecurityCollection(); securityCollection.addPattern("/*"); SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.addCollection(securityCollection); if (needHTTPS) { securityConstraint.setUserConstraint("CONFIDENTIAL"); } if (needAuthentication) { LoginConfig loginConfig = new LoginConfig(); loginConfig.setAuthMethod("DIGEST"); loginConfig.setRealmName(InMemoryRealm.NAME); context.setLoginConfig(loginConfig); securityConstraint.addAuthRole(InMemoryRealm.AUTH_ROLE); context.addSecurityRole(InMemoryRealm.AUTH_ROLE); DigestAuthenticator authenticator = new DigestAuthenticator(); authenticator.setNonceValidity(10 * 1000L); authenticator.setNonceCacheSize(20000); context.getPipeline().addValve(authenticator); } context.addConstraint(securityConstraint); } context.setCookies(false); return context; }