1 19 20 package org.netbeans.modules.j2ee.ejbjarproject; 21 22 import java.io.File ; 23 import java.net.MalformedURLException ; 24 import java.net.URL ; 25 import org.openide.filesystems.FileUtil; 26 27 31 public class EjbJarProjectUtil { 32 private EjbJarProjectUtil() { 33 } 34 35 45 public static URL getRootURL (File root, String offset) throws MalformedURLException { 46 URL url = root.toURI().toURL(); 47 if (FileUtil.isArchiveFile(url)) { 48 url = FileUtil.getArchiveRoot(url); 49 } else if (!root.exists()) { 50 url = new URL (url.toExternalForm() + "/"); } 52 if (offset != null) { 53 assert offset.endsWith("/"); url = new URL (url.toExternalForm() + offset); } 56 return url; 57 } 58 } 59 | Popular Tags |