> -----Original Message----- > From: Pilkington, Simon [mailto:simo...@amazon.com] > Sent: Tuesday, March 17, 2015 12:45 PM > To: users@tomcat.apache.org > Subject: [Tomcat8] What happened to WebappLoader.addRepository()? > > Hey tomcat users, > > The javadoc for WebappLoader still tells me to use addRepository(), but > that method no longer exists. My team has implemented an extension of > WebappLoader that looked like this: > > http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL > 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA- > LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R > lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb > _6HtfelAv3UYK2FRlJI- > Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe > IiNEEd598S-UrI1Lf5-sL > http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO- > YqenASjqdQPhO- > YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK > qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI- > Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc > 2WrWr9EVjb_6HtfelAv3UYK2FRlJI- > Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe > IiNEEd598S-UrHrI5 > > @Override > protected void startInternal() throws LifecycleException { > // validate the context, which is used for debugging messages > Context context; > { > Container container = getContainer(); > if (container == null) { > throw new LifecycleException("Container is null?!"); > } > if (!(container instanceof Context)) { > throw new LifecycleException("Container is not an > instance of Context?!"); > } > context = (Context) container; > } > > if (ENVIRONMENT_ROOT != null && ENVIRONMENT_ROOT.length() > 0) { > // validate targetPackage > if (null == targetPackage) { > throw new LifecycleException( > "Missing required Loader attribute > \"targetPackage\" in Context configuration " + > context.getConfigFile()); > } > > try { > // Excluded jars are those already pulled in by tomcat. > Set<String> allExcludedJars = getAllExcludedJars(); > Set<String> reallyExcludedJars = new HashSet<String>(); > // add JARs from target package as "repositories" > // getPackageClasspath finds the list of jars I want to > include for this webapp. > for (String jar : getPackageClasspath(targetPackage)) { > File file = new File(ENVIRONMENT_ROOT, jar); > // skip bad and unwanted JARs > if (allExcludedJars.contains(jar) || isBadJar(file)) > { > reallyExcludedJars.add(jar); > } else { > // TODO: HOW TO FIX ME?? > addRepository(file.toURI().toString()); > } > } > log.info("Context path \"" + context.getPath() + "\" > excluding JARs: " + reallyExcludedJars); > } catch (IOException e) { > throw new LifecycleException( > "Problem setting classpath for context path \"" > + context.getPath() + "\"", > e); > } > > // getRepositoriesString() has been renamed to > getLoaderRepositoriesString()... > log.info("Context path \"" + context.getPath() + "\" using > classpath: " + getRepositoriesString()); > } else { > log.warning("MyWebappLoader seems to be used outside of my > environment. Delegating to parent."); > } > > super.startInternal(); > } > > Can the community help me figure out how to upgrade this for tomcat 8?
JarResourceSet jrs = new JarResourceSet(Context.getResources(), "/", file.getAbsolutePath(), "/"); Context.getResources().addPostResources(jrs); --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org