Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile.toURL()


     //Regular jar
     URL url = getResource("/vfs/test");
     VirtualFile root = VFS.getRoot(url);
     VirtualFile jarFile = root.getChild("badmf.jar");
       
     URL vfsURL = jarFile.toURL();
     assertTrue(vfsURL.toExternalForm().startsWith("vfszip"));
     URL realURL = VFSUtils.getRealURL(jarFile);
      // TODO - JBVFS-77 --> do proper tests!
     assertTrue(realURL.toExternalForm().startsWith("jar:"));
    
View Full Code Here


     assertTrue(realURL.toExternalForm().startsWith("jar:"));
      
     //Regular file
     url = getResource("/vfs/context/file/simple");
     VirtualFile regularFile = VFS.getRoot(url).getChild("tomodify");
     vfsURL = regularFile.toURL();
     assertTrue(vfsURL.getProtocol().startsWith("vfsfile"));
     realURL = VFSUtils.getRealURL(regularFile);
      // TODO - JBVFS-77 --> do proper tests!
     assertTrue(realURL.toExternalForm().startsWith("file:"));
   }
View Full Code Here

      VirtualFile child = findChild(path);
      if (child != null)
      {
         try
         {
            return child.toURL();
         }
         catch (Exception ignored)
         {
            log.debug("Error determining URL for " + child, ignored);
            return null;
View Full Code Here

      {
         try
         {
            VirtualFile child = root.getChild(name);
            if (child != null)
               urls.add(child.toURL());
         }
         catch (Exception e)
         {
            log.debug("Error getting resources for " + root, e);
         }
View Full Code Here

      URL rootURL = null;
      if (root != null)
      {
         try
         {
            rootURL = root.toURL();
            manifest = manifestCache.get(rootURL);
            if (manifest == null)
            {
               manifest = VFSUtils.getManifest(root);
               if (manifest == null)
View Full Code Here

         return null;
      }
      try
      {
         VirtualFile root = findRoot(path);
         URL codeSourceURL = root.toURL();
         Certificate[] certs = null; // TODO JBMICROCONT-182 determine certificates
         CodeSource cs = new CodeSource(codeSourceURL, certs);
         PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
         return new ProtectionDomain(cs, permissions);
      }
View Full Code Here

   {
      URL rootURL = getResource("/vfs/test");
      VFS vfs = VFS.getVFS(rootURL);

      VirtualFile outerJar = vfs.findChild("unpacked-outer.jar");
      URL outerURL = outerJar.toURL();
      log.debug("outerURL: "+outerURL);
      assertTrue(outerURL+" ends in '/'", outerURL.getPath().endsWith("/"));
      // Validate that jar1 is under unpacked-outer.jar
      URL jar1URL = new URL(outerURL, "jar1.jar/");
      log.debug("jar1URL: "+jar1URL+", path="+jar1URL.getPath());
View Full Code Here

      // Validate that jar1 is under unpacked-outer.jar
      URL jar1URL = new URL(outerURL, "jar1.jar/");
      log.debug("jar1URL: "+jar1URL+", path="+jar1URL.getPath());
      assertTrue("jar1URL path ends in unpacked-outer.jar/jar1.jar!/", jar1URL.getPath().endsWith("unpacked-outer.jar/jar1.jar/"));
      VirtualFile jar1 = outerJar.findChild("jar1.jar");
      assertEquals(jar1URL.getPath(), jar1.toURL().getPath());

      VirtualFile packedJar = vfs.findChild("jar1.jar");
      jar1URL = packedJar.findChild("org/jboss/test/vfs/support").toURL();
      assertTrue("Jar directory entry URLs must end in /: " + jar1URL.toString(), jar1URL.toString().endsWith("/"));
   }
View Full Code Here

      searchCtx.add("outer.jar");
      VirtualFile metaInf = vfs.resolveFile("META-INF/MANIFEST.MF", searchCtx);
      */
      VirtualFile metaInf = jar.findChild("META-INF/MANIFEST.MF");
      assertTrue("META-INF/MANIFEST.MF != null", metaInf != null);
      InputStream mfIS = metaInf.toURL().openStream();
      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
      Manifest mf = new Manifest(mfIS);
      Attributes mainAttrs = mf.getMainAttributes();
      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
      assertEquals("1.0.0.GA", version);
View Full Code Here

      Attributes mainAttrs = mf.getMainAttributes();
      String version = mainAttrs.getValue(Attributes.Name.SPECIFICATION_VERSION);
      assertEquals("1.0.0.GA", version);
      mfIS.close();

      String urlString = metaInf.toURL().toString();
      URL mfURL = new URL(urlString);
      mfIS = mfURL.openStream();
      assertTrue("META-INF/MANIFEST.MF.openStream != null", mfIS != null);
      mf = new Manifest(mfIS);
      mainAttrs = mf.getMainAttributes();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.