This content has been marked as final.
Show 2 replies
-
1. Re: Using the VFS to read a resource from nested jars
jason.greene Dec 13, 2006 11:02 AM (in response to thomas.diesler)See the man test cases located here:
http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/trunk/container/src/tests/org/jboss/test/virtual/test/
However, what you are looking for is DeploymentUnit.getMetaDataFile(String)
or
DeploymentUnit.getFile(String)
The former searches relative to WEB-INF/META-INF the latter is at the root of the deployment.
If you were using the VFS outside of a deployer then the usage looks like this:
VFS vfs = VFS.getVFS(anyURL);
VirtualFile jar = vfs.findChild("something.txt"); -
2. Re: Using the VFS to read a resource from nested jars
starksm64 Dec 13, 2006 12:31 PM (in response to thomas.diesler)The jar urls are gone in the current snaphsot. You do not need to go through the URL to read a resource. You can use the openStream method of the VirtualFile:
VirtualFile jar1MF = jar1.findChild("META-INF/MANIFEST.MF"); assertNotNull("jar1!/META-INF/MANIFEST.MF", jar1MF); InputStream mfIS = jar1MF.openStream(); Manifest mf1 = new Manifest(mfIS); Attributes mainAttrs1 = mf1.getMainAttributes(); String title1 = mainAttrs1.getValue(Attributes.Name.SPECIFICATION_TITLE); assertEquals("jar1", title1); jar1MF.close();